Reply
Floating Help
Old 02-17-2008, 01:53 PM Floating Help
Average Talker

Posts: 15
Hi, im floating a couple of divs inside a container.

The problem is, is that they are overlapping it and not staying in side. So that when i add data the floats height increases but not the container.

Screen Shot: http://sixpop.com/images/file/14694217.jpg

Html:

Code:
<!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>No Title</title>
<link rel="stylesheet" type="text/css" href="css.css">
</head>
<body>
<div id="profilewrap">
<div id="block12">
STUFF
<div id="leftblock"></div>

<div id="righblock">
</div>

</div>

</body>
</html>

Css:

Code:
body{
background: #fff;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
margin: 0px;
padding: 0px;
text-align: center;
}
#profilewrap{
}
#block12{
background: #000;
color: #fff;
padding: 5px;
width: 750px;
text-align: left;
margin: 0 auto;
}

#leftblock{
width: 375px;
float: left;
margin: 0;
}
#righblock{
width: 375px;
float: right;
margin: 0;
}




Please help!, thanks in advanced!!!!!!
Vivid Lust is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 02-17-2008, 02:11 PM Re: Floating Help
bas
Skilled Talker

Posts: 66
Name: Bas
Location: Belgium
First of all, you forgot to close a div! It has to be:
HTML Code:
<div id="profilewrap">
  <div id="block12">
STUFF
    <div id="leftblock"></div>
    <div id="righblock"></div>
  </div>
</div>
Secondly, in XHTML every element has to be closed, so:

HTML Code:
<link rel="stylesheet" type="text/css" href="css.css" />
Now to resolve your problem with the overlapping div, you can add an element at the bottom of the container div, and give that element with css the property "clear:both; ".

For example, a break-element:
HTML Code:
<!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>No Title</title>
<link rel="stylesheet" type="text/css" href="css.css" />
</head>
<body>
<div id="profilewrap">
<div id="block12">
STUFF
<div id="leftblock"></div>

<div id="righblock">
</div>
<br class="clearer">
</div>
</div>

</body>
</html>
CSS:
Code:
.clearer {
clear:both;
}
__________________
Don’t hesitate ... Talkuptation points are safe with me!

Last edited by bas : 02-17-2008 at 02:13 PM.
bas is offline
Reply With Quote
View Public Profile Visit bas's homepage!
 
Old 02-18-2008, 02:36 PM Re: Floating Help
LadynRed's Avatar
Super Moderator

Posts: 6,072
Location: Tennessee
The point is, you must learn to CLEAR YOUR FLOATS - more here:
http://css-discuss.incutio.com/?page=ClearingSpace
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Floating Help
 

Thread Tools

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

vB 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.12249 seconds with 13 queries