1. CSS HACK
The following two methods can solve almost all HACKs today.
1. !important
With IE7's support for !important, the !important method now only targets IE6's HACK. (Note on writing: remember that the declared position needs to be stated in advance.)
<style> #wrapper { width: 100px!important; width: 80px; } </style> |
*+html and *html are IE-specific tags and are not supported by Firefox yet. And *+html is a unique tag for IE7.
<style> #wrapper { #wrapper { width: 120px; } *html #wrapper { width: 80px;} *+html #wrapper { width: 60px;} } </style> |
Notice:
*+html HACK for IE7 must ensure that there is the following statement at the top of the HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" ""> |
2. float closed (clear float)
Add the following code to Global CSS and add class="clearfix" to the div that needs to be closed. It works every time.
<style> .clearfix:after { content:"."; display:block; height:0; clear:both; visibility:hidden; } .clearfix { display:inline-block; } .clearfix {display:block;} </style> |