A common problem with float-based layouts is that the floats’ container doesn’t want to stretch up to accomodate the floats.
Solution: overflow: hidden;
check out the original article at
A common problem with float-based layouts is that the floats’ container doesn’t want to stretch up to accomodate the floats.
Solution: overflow: hidden;
check out the original article at
This is very useful and provided by YUI (Yahoo! UI Library).
I didn’t have any good impression toward to Yahoo! before.
But i am very glad they could share their UI database to open source.
Check out the original documents from here
http://developer.yahoo.com/yui
| If you want this size in pixels (px) | Declare this percent (%) |
|---|---|
| 10 | 77 |
| 11 | 85 |
| 12 | 93 (was 93) |
| 13 | 100 |
| 14 | 108 (was 107) |
| 15 | 116 (was 114) |
| 16 | 123.1 (was 122) |
| 17 | 131 (was 129) |
| 18 | 138.5 (was 136) |
| 19 | 146.5 (was 144) |
| 20 | 153.9 (was 152) |
| 21 | 161.6 (was 159) |
| 22 | 167 |
| 23 | 174 |
| 24 | 182 |
| 25 | 189 |
| 26 | 197 |
The following CSS selectors are considered workarounds and hacks for specific web browsers.
IE 6 and below
* html {}
IE 7 and below
*:first-child+html {} * html {}
IE 7 only
*:first-child+html {}
IE 7 and modern browsers only
html>body {}
Modern browsers only (not IE 7)
html>/**/body {}
Recent Opera versions 9 and below
html:first-child {}
Source: CSS Hacks
Usage
If you want to add 5px padding to a div element called #comments specifically for IE 7, then you can use the following hack:
*:first-child+html #comments {
padding: 5px;
}
But if you want to apply the padding just for IE 6, then the following will do the trick:
* html #comments {
padding: 5px;
}
Note that CSS Hacks are not recommended due to their dependence on browser bugs and therefore they should only be used as the last resort.
A more comprehensive article on CSS Hacks can be found here.
Source: http://eisabainyo.net/weblog/2007/04/18/css-hacks-for-ie-7-ie-6-opera-etc/
Using CSS to Fix Anything: 20+ Common Bugs and Fixes
http://www.noupe.com/css/using-css-to-fix-anything-20-common-bugs-and-fixes.html
Using Javascript to Fix 12 Common Browser Headaches
http://www.noupe.com/css/using-javascript-to-fix-12-common-browser-headaches.html
IE Double Margin Float Bug
Solution: display: inline;
http://www.cssnewbie.com/double-margin-float-bug/