1. Different explanations of the box interpreter.
The code is as follows: |
Copy code |
# Box { Width: 600px; // for ie6.0- Width: 500px; // for ff + ie6.0 } # Box { Width: 600px! Important // for ff Width: 600px; // for ff + ie6.0 Width/**/: 500px; // for ie6.0- }
|
2. Hide css in ie and use the sub-selector
The code is as follows: |
Copy code |
Html> body # box {}
|
3. Only ie recognition
* Html # box {}
4. Valid in ie/win while hidden in ie/max. Use a backslash.
/**/
5. Define a style for ie
6. Double distance of floating ie
The code is as follows: |
Copy code |
# Box { Float: left; Width: 100px; Margin: 0 0 0 100px; // in this case, IE will generate a PX distance. Display: inline; // ignore floating }
|
Here, let's take a closer look at the block and inline elements. The characteristics of the Block elements are that they can always start on a new line, and the height, width, row height, and margins can be controlled (block elements ); the features of the Inline element are as follows: on the same line as other elements ,... uncontrollable (embedded element );
The code is as follows: |
Copy code |
# Box { Display: block; // you can simulate embedded elements as block elements. Display: inline; // implement the same row arrangement Diplay: table; // for ff, simulating the table effect }
|
7, for oprea only
The code is as follows: |
Copy code |
@ Media all and (min-width: 0px) {/* opera */ # Box {} }
|
8. Issues with IE and width and height
IE does not recognize the min-definition, but in fact it treats normal width and height as min conditions. In this case, the problem is big. If only the width and height are used,
In a normal browser, these two values will not change. If only min-width and min-height are used, the width and height under IE are not set at all.
For example, to set a background image, the width is important. To solve this problem, you can:
The code is as follows: |
Copy code |
# Box { Width: 80px; Height: 35px; } Html> body # box { Width: auto; Height: auto; Min-width: 80px; Min-height: 35px; }
|
9. Minimum page width
Min-width is a very convenient CSS command, which can specify that the element is at least or less than a certain width, so as to ensure correct layout. But IE does not recognize this, but it actually uses width as the minimum width. To make this command usable on IE, you can place <div> Under the <body> label and specify a class for div. CSS is designed as follows:
The code is as follows: |
Copy code |
# Container { Min-width: 600px; Width: expression (document. body. clientWidth <600? "600px": "auto "); }
|
The first min-width is normal, but the width of line 2nd uses Javascript, which is recognized only by IE, which will make your HTML document not formal. It actually achieves the minimum width through Javascript judgment.