sensuous-love
Members
-
Joined
-
Last visited
Reputation Activity
-
sensuous-love reacted to rbrtsmith in float or display inline?He has used it as a clearfix solution - stopping the parent container collapsing when it has floated children, floated elements are taken out of the normal document flow causing the parent to collapse.
I prefer to use this clearfix solution because at times you do want content to overflow - such as a drop down have on hover or similar. Give the ul a class of clearfix
then
.clearfix:before { display: table; clear: both; content: " "; } -
sensuous-love reacted to rbrtsmith in float or display inline?you can use either, I personally use floats, reason being is that display-inline block adds a tiny bit of margin to the element (The size of the margin being related to the font size either specified to the element or inherited from a parent / ancestor).
-
sensuous-love reacted to Wickham in float or display inline?You could use display: inline-block for the li tag, but float is better because it's better for positioning (like margins). Use this code to see the difference:
<!DOCTYPE html> <html> <meta charset="UTF-8" /> <title>test</title> <style type="text/css"> ul { list-style-type: none; overflow: hidden; background: pink; } ul li { display: inline-block; background: lime; } ul li a { display: block; padding: 10px; width:80px; background: #aaa; } ul li a:hover { background: skyblue; } ul.b { list-style-type: none; overflow: hidden; width:200px; background: pink; } ul.b li { float:left; width: 100px; background: lime; } ul.b li a { display: block; padding: 10px; width:80px; background: #aaa; } ul.b li a:hover { background: skyblue; } </style> </head> <body> <ul> <li><a href="http://www.facebook.com">Facebook</a></li> <li><a href="httpt://www.google.com">Google</a></li> </ul> <ul class="b"> <li><a href="http://www.facebook.com">Facebook</a></li> <li><a href="httpt://www.google.com">Google</a></li> </ul> </body> </html> -
sensuous-love reacted to sash_oo7 in float or display inline?I would say float is better
check the following example
ul { list-style-type: none; overflow: hidden; width:200px; } ul li { float:left; width: 100px; } ul li a { display: block; padding: 10px; width:80px; } ul li a:hover { background: black; } <ul> <li><a href="http://www.facebook.com">Facebook</a></li> <li><a href="httpt://www.google.com">Google</a></li> </ul> here u can see when u use display:inline u cannot set properties like width, padding (top and bottom), margin etc... which is an handicap for layout purposes.
-
sensuous-love reacted to sash_oo7 in confused about wrapper divuse a wrapper class instead of id .. tht way u can use it repeatedly
like this
and make footer and header width 100%
<div id="header"> <div class="wrapper"> header content... </div><!--wrapper--> </div> <div class="wrapper"> <div id="banner"> banner content... </div> <div id="content"> main content... </div> </div><!--wrapper--> <div id="footer"> <div class="wrapper"> footer content... </div><!--wrapper--> </div> .wrapper { width:960px; margin:0 auto; } #header { width:100%; background:#06C; height:200px; } #banner { background:#0C9; } #content { background:#666666; } #footer { width:100%; height:50px; background:#993333; } -
sensuous-love reacted to webdeveloper93 in confused about wrapper divU could put both the header and footer outside the wrapper