jquery - css clear floats with multiple divs -
i need clear floats after left , right div..ie; left div should match whole size of right div..but unfortunately dont see working.
css
#left{ float:left; background-color:gray } #right{ float:left; background-color:gray }
html
<div> <div id="left"> <ul id="ul1" style="list-style-type:none"> <li><a style="color:orange" href="/">about us</a></li> <br> <li><a style="color:orange" href="/players">players</a></li> <br> <li><a style="color:orange" href="/contactus">contact us</a></li> </ul> </div> <div id="right"> content. <br> content. <br> content. <br> content. <br> content. <br> content. <br> content. <br> content. <br> content.<br> content. </div> <div style="clear: both;"></div> </div> <div style="clear: both;"></div> <div> </div>
there's cool trick on how this.
first, apply padding-bottom:100%;
each div.
next, apply margin-bottom:-100%;
each div.
finally, add overflow:hidden;
div inside.
presto! true happiness yours.
css:
#top{background:yellow;overflow:hidden;} #left{float:left;background-color:gray;padding-bottom:100%;margin-bottom:-100%;} #right{float:left;background-color:gray;padding-bottom:100%;margin-bottom:-100%;}
note added id container div styled.
references:
Comments
Post a Comment