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.

CSS Forum


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



Reply
Old 02-17-2008, 02:53 PM Floating Help
Valiant's Avatar
Super Talker

Posts: 112
Location: England
Trades: 0
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!!!!!!
Valiant is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-17-2008, 03:11 PM Re: Floating Help
bas
Super Talker

Posts: 108
Name: Bas
Trades: 0
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;
}

Last edited by bas; 02-17-2008 at 03:13 PM..
bas is offline
Reply With Quote
View Public Profile
 
Old 02-18-2008, 03:36 PM Re: Floating Help
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
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 !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Floating Help
 

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.11870 seconds with 12 queries