I. css hack
The following two methods can solve almost all today's hack.
1 ,! Important
With ie7! Important support ,! The important method is only for the hack of ie6. (note the writing method. Remember to advance the declaration position .)
| The code is as follows: |
Copy code |
<Style> # Wrapper { Width: 100px! Important; Width: 80px; } </Style>
|
2, ie6/ie77 for firefox
* + Html and * html are unique tags of ie, which are not supported by firefox at the moment. * + html is also a unique tag of ie7.
| The code is as follows: |
Copy code |
<Style> # Wrapper { # Wrapper {width: 120px ;} * Html # wrapper {width: 80px ;} * + Html # wrapper {width: 60px ;} } </Style>
|
Note:
* + The html hack for ie7 must ensure that the following statements are made on the top of the html:
<! Doctype html public "-// w3c // dtd html 4.01 transitional // en">
2. float closure (clear floating)
Add the following code to global css and add class = "clearfix" to the div to be closed.
| The code is as follows: |
Copy code |
<Style> . Clearfix: after { Content :"."; Display: block; Height: 0; Clear: both; Visibility: hidden; } . Clearfix { Display: inline-block; } . Clearfix {display: block ;} </Style> |