Forum Moderators: not2easy

Message Too Old, No Replies

float problem in firefox

floated div not constrained by parent div?

         

CgiBin

3:53 pm on Apr 4, 2005 (gmt 0)

10+ Year Member



The following code works as expected in IE6, but FF the floated divs aren't inside the boredered div.

If I also float the boredered div, it sorta works, but the size is wrong. Am I missing something here?


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel='stylesheet' href='salesNet.css' type='text/css'>
<style type="text/css">
* {
color: #333333;
font-family: Arial, Verdana, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
font-variant: normal;
letter-spacing: normal;
text-decoration: none;
margin: 0px;
padding: 0px;
}

body, html {
width: 100%;
height: 100%;
}

body {
background-color: transparent;
background-image: none;
}

div#mainDiv {
position: absolute;
width: 600px;
left: 50%;
margin-left: -300px;
padding: 2px;
}

div.floatLeft {
float: left;
}

.topbotBorder {
border-style: solid none;
border-width: 1px;
border-color: black;
}

.BG_white {
background-color: #FFFFFF;
}
</style>
</head>
<body>
<div id="mainDiv" class="BG_white">
<div class='topbotBorder'>
<div class="floatLeft" style="width: 100px;">
Description:
</div>
<div class="floatLeft">
yadda yadda yadda
<br>etc etc etc
</div>
</div>
</div>
</body>
</html>

skube

8:40 pm on Apr 4, 2005 (gmt 0)

10+ Year Member



It might be helpful to look at containg floats [complexspiral.com]

and do something like:


<div id="mainDiv" class="BG_white">
<div class='topbotBorder'>
<div class="floatLeft" style="width: 100px;">Description:</div>
<div class="floatLeft">yadda yadda yadda<br>etc etc etc</div>
<div style="clear:both">&nbsp;</div>
</div>
</div>

cheers,
s¦<ube

CgiBin

2:28 pm on Apr 5, 2005 (gmt 0)

10+ Year Member



Thanks.

I've actually seen that very page before, but it just didn't click that that's what I needed to do.