View Full Version : HTML/CSS/DIV Columns

11-20-2010, 11:53 PM

That's what it should look like (it does in Dreamweaver). It fails to do so when displayed in browser. Any help appreciated.


.new {background-color:#41383C;color:#98AFC7;}
.czas {font-family:verdana;color:#eeeeee;background-color:#595454; border:1px solid black;padding:2px}
.link {color:#808080;}
.link:hover {color:#a0a0a0}
body{margin: 0;padding: 0;}
#banner {margin: 0;padding: .5em;}
#nav{float: left;width: 45%;}
#nav p{margin-top: 0;}
#content{padding-top: 1em; float:left;width:25%;}
#content2{padding-top: 1em; float:left;width:25%;}
.dt {height:22px;}
.dt2 {height:19px;}
<body bgcolor="595454">
<div class="new" style="margin: 1em 5%;">
<div align="center" id="banner"><strong style="font-size:26px">X</strong></div>
<div id="nav" style="height:345px" align="center"><strong style="font-size:26px;">X</strong></div>
<div id="content" style="height:265px; padding-left:15px">
<a href="mailingList2.php?addEmail=decor" class="link">XXXX</a></div>
<div id="content2" style="height:265px;">XXXX</div>
<div id="subheader" style="height:80px;padding-left:0%;" align="left"><!--[if IE]>
<span style="width:450"><![endif]--> XXXX </div>
<div align="center" class="new" style="font-weight:bold; width:100%">XXXX</div>

11-21-2010, 12:43 AM
Hello Jedziemy,
Dreamweaver is famous for not rendering code like any known browser. Hopefully you did not buy DW for it's Design window. Instead, just test your code in a real browser, like FireFox.

Your not seeing .new expand to contain it's elements because they are floated and you have not cleared your floats.
Try making your CSS look like this -
.new {
background: #41383C;
color: #98AFC7;
overflow: auto;

Here's a page that describes how overflow: auto; clears floats (http://www.quirksmode.org/css/clearing.html).

Of course, even after you clear the floats it doesn't look like DW's design window is showing it. Those yellow dotted lines are a DW thing and not a part of your code.

Also, your inline styles will not help you later. It's much better to style things from the CSS.