smerny Posted June 14, 2009 Share Posted June 14, 2009 .fh2{width: 900px;background: #99ffff;border: 1px solid #fff;color: #339933;margin: 0;padding: 0px;clear: both;}.left{float: left;}.right{float: right;} <div class='fh2'> <div class='left'> <a href='index.php?page_mode=boardview&board_id=1'>cat1 board1</a> - </div> <div class='right'> Last post by <a href='../members.php?action=getinfo&userid=1'>testuser</a> </div> </div> I was expecting everything within fh2 to take on the color and background color, but it wont... if i comment out the .left and .right in the CSS sheet it does... so a div with float:left and float:right and NO colors negates the colors in the outer div? Link to comment Share on other sites More sharing options...
cedric Posted June 14, 2009 Share Posted June 14, 2009 it are the <a href>-tags that do not inherit the styling of the parent, they never do.Where you have in the css.fh2 { ... }make it.fh2,.fh2 a { ... }That will fix it. Link to comment Share on other sites More sharing options...
dsonesuk Posted June 14, 2009 Share Posted June 14, 2009 Remove clear: both; and insert float: left;because this has no float assigned to it, it is ignored and does not contain the other divs, it just shows as an empty div.ORif you require the clear: both within .fh2, then insert <div style="clear:left; height: 0px; font-size:0px; line-height:0px;"> </div> below right div, but within fh2 outer div. Link to comment Share on other sites More sharing options...
jlhaslip Posted June 14, 2009 Share Posted June 14, 2009 the container div needs to be cleared.http://csscreator.com/?q=attributes/containedfloat.php Link to comment Share on other sites More sharing options...
smerny Posted June 14, 2009 Author Share Posted June 14, 2009 okay, i have it working... but I still don't really understand why it wouldn't to next it the way I had it? Link to comment Share on other sites More sharing options...
dsonesuk Posted June 14, 2009 Share Posted June 14, 2009 The problem is discussed here, with old and new solutions http://www.quirksmode.org/css/clearing.html Link to comment Share on other sites More sharing options...
smerny Posted June 14, 2009 Author Share Posted June 14, 2009 that was helpful, thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.