css

CSS float property tweak


If you have ever done any work styling a web page with CSS, specifically the float attribute, you may have come across a minor annoyance. If you are floating a div within a larger ‘main’ div, you usually want the height of the main div to expand/shrink according to the height of the div placed inside. However, in some browsers, if the inside div inside is floated, the main div does not recognize the height of the div inside. This can be avoided by simply adding the following attribute to your main div in your CSS:

#main { 
overflow:hidden; 
}

The main div will now size itself according to the size of the div inside. Hope this helps!


You may also like:

IE space between images Anyone that does a fair amount of web design knows that Internet Explorer likes to "set itself apart" from the other major browers by not interpreting...
Get rid of dashed box around links A great easy improvement for any website is getting rid of that annoying dashed box that appears when clicking on a link. Many big sites like eBay.com...
Bullets in HTML email disappearing? Are you crafting an HTML email to send out and trying to use bullets? If they are suddenly disappearing in Outlook 2007 or Outlook 2010, try adding th...
READ ALSO  Backslashes Aren't Working in WordPress Posts