Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Nested divs not working?
Old 10-22-2008, 04:48 PM Nested divs not working?
freeman17's Avatar
Average Talker

Posts: 16
Trades: 0
For some reason the "left" and "right" divs are not staying within the "content" div. I have posted the HTML/CSS. I can't seem to figure this out!

HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Title</title>
<link rel="stylesheet" href="style.css" type="text/css" media="screen">
</head>

<body>



<div class="wrap">
<img src="images/trimtop.gif" align="top" />
<div class="container">

<div class="header"></div>

<div class="nav">nav</div>

<div class="content">


<div class="left">left content</div>

<div class="right">right content</div>



</div>

<div class="footer">foot</div>

</div>
<img src="images/trimbottom.gif" align="bottom" />
</div>



</body>
</html>



CSS:

@charset "UTF-8";
/* CSS Document */


body {
font-family:Arial, Helvetica, sans-serif;
background-image:url(images/gradient.png);
background-repeat:repeat-x;
background-color:#b1b1b1;
maring:0px;
padding-top:25px;
text-align:center;
}



.wrap {
margin:0px auto;
padding:10px 0px 10px 0px;
text-align:left;
width:900px;

background-repeat:repeat-y;
}

.container {
margin:0px auto;
width:700px;

}

.header {
width:700px;
height:124px;
background-image:url(images/header.gif);
background-repeat:no-repeat;
}

.nav {
width:700px;
height:30px;
}

.content {
padding:0px;
width:700px;
background-color:#ffffff;
color:#666666;
}

.left {
padding:20px;
width:300px;
float:left;
}

.right {
padding:20px;
width:300px;
float:right;
}

.footer {
clear:both;
width:700px;
}




Thanks for the help!
freeman17 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-22-2008, 05:05 PM Re: Nested divs not working?
aldor's Avatar
Ultra Talker

Posts: 479
Name: Alan
Location: Lincoln(UK)
Trades: 0
I haven't checked through all your HTML and CSS but note that you have failed to close:-
Code:
<link rel="stylesheet" href="style.css" type="text/css" media="screen">
This will throw all the rest of the tags out as closing all elements in XHTML is mandatory.
aldor is offline
Reply With Quote
View Public Profile
 
Old 10-22-2008, 05:09 PM Re: Nested divs not working?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
that won't make any difference at all, only a validator will throw an error at that.

the issue is you haven't cleared the floats before closing the content div.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-22-2008, 05:27 PM Re: Nested divs not working?
freeman17's Avatar
Average Talker

Posts: 16
Trades: 0
Ok, thanks for the replies!

chrishirst, how do I go about clearing the floats? Sorry, I'm still new at this!
freeman17 is offline
Reply With Quote
View Public Profile
 
Old 10-22-2008, 05:28 PM Re: Nested divs not working?
freeman17's Avatar
Average Talker

Posts: 16
Trades: 0
Nevermind, I got it!

Thanks a bunch!
freeman17 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Nested divs not working?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.35185 seconds with 12 queries