1. Question about CSS Abbreviations: $ F * X5 a % N: N "J/v6 v7_whether it is IE or FF, there is a small problem with CSS abbreviations, such as: Border: 0xp solid # FFF; there is no problem with the support of both browsers. However, if the magin of the four sides is different, this abbreviation cannot be used. The boundary interpretation error may occur either in IE or ff, this causes page deformation. $ N. M $ O. N4 W9 ^! C & E4 B) E5 R Abbreviation: 6 N; j7 O7 [/V9 V0 H! L Border-width: 0px 1px 2px 3px; 4 U) W1 l0 I, Y "W # oborder-style: solid; ! I: V. Q/l7 ;~ & I6 I3 [+ V8 custom fborder-color: # FFF; Z & '"Q-G $ ~ % K2, magin padding, and other default values 9? 'Q -~ 2 K $ W ;[. p7 y * l ie has a default value of 0px for the magin padding of CSS, but FF is different. To maintain the uniformity of appearance, even if the padding is 0, you should write it, avoid FF misplacement in browsing. # M %/8 e '^ 9 V. L "R" U "F & Y4 y7}-y; C V5 Q1 Z. N * R5 U .} 3. Center) S) E, B4 ~ -V Z In IE, you can use body {text-align: center;} to align the center. In Firefox, it is always on the left. However, if float: Right is added, it cannot be in the middle when it reaches the right. In ff, set the Left and Right outer patches of the container to auto. * F. B * ^ 7 W2 X! L! Emargin-Right: auto; 2 ~ % E # G. {$ ?. X/W0 {'B Margin-left: auto;, P %] (X: H )'! M '? For example: margin: 0 auto; 9 m % M. W "E ,? C; Y % Q. B) Friends of I2 B and bugs-browser remedies, bugs and solutions (Part 1) * M J (T & C8 @. B3 K /@ Http://realazy.org/blog/2006/07/29/working-with-buggy-browsers-1 '') S/L; N * q/I (E ====================================== ======================================== 0 y/U % B3 V/G/J5 P0 ~ "Difference between ufirefox and IE in CSS style 1 CSS style 6 U. _ 4 I2 X1 for Firefox IE6 IE7 ?! O9 X, n Most of them are used now! Important comes to hack. It can be displayed normally for IE6 and Firefox tests, 3 Z # L/K + Q * G3 W. C * D +? 4 D, but IE7! Important can be correctly explained, and the page will not be displayed as required! Find a needle 4 N: K-g/K -~ The good hack Method for IE7 is to use "* + html". Now you can use IE7 to browse it. It should be okay. (X7/7 [^ + N0 W. Now you can write a CSS file like this: 4 N $/;] 5] + A5} "C . N * D/V! P7 H + B, P % [! C #1 {color: #333;}/* Moz */: B! T % F-| 'P (J $ U & B * Html #1 {color: #666 ;}/ * IE6 */8? 3 | # I 't7 D5 ^ 9 t * + Html #1 {color: #999 ;}/ * IE7 */"B. @ 2 L; P' x *? % Z The font color in Firefox is displayed as #333, the font color in IE6 is displayed as #666, And the font color in IE7 is displayed as #999. 7 A7 _ 7 z7 H * o /[! B2 V, g (P % C (? $ M * j 2. center problem in CSS layout 5 I "/5 V1 Z/A8 '3 M * w main style definition: 6 q + P0 M-[. T/e-W * T6 d (K'e; U & Y "E; V8 E, hbody {text-align: center ;} 9 r'e0 D1 g, |-F9 U (y # center {margin-Right: auto; margin-left: auto ;} 9 I '}! @ * G8 C description: "Q & R; {3 s/w $ v * n; S/x F & D/g first defines text-align: center in the parent element; this means that the content in the parent element is centered; for IE, this setting is enough. -^ 7 d # I6 G8 U $ I. p-D R0 v However, it cannot be centered in Mozilla. The solution is to add "margin-Right: auto; margin-left: auto;" when the sub-element is defined ;" 1 I4 Q-o8 W8} 1 t it should be noted that, if you want to use this method to center the entire page, we recommend that you do not set it in a div, you can split multiple Div, "~ * O '-C, @ * U2 L: K (~ You only need to define margin-Right: auto; margin-left: auto; in each split Div. % Z4], _! ^-@ 6 J) L 'T. J (K; L6 H3 box model different interpretations. 4 V8 Z: G; W4 W1 s, [O +/; c : '"Q! H # B4 {4 P d * k $ W1 J # box {width: 600px; // For ie6.0-W/idth: 500px; // for FF + ie6.0} 5 u'n' (J + G % S2 H4 S & C; G # box {width: 600px! Important // for FF width: 600px; // for FF + ie6.0 width/**/: 500px; // For ie6.0 -} % I-F5 X & Z, u (N6 {(W9 ^ $ J:] U3 y # W 4. Double distance of floating IE ; M3 B! X0 C + R! Y3 N: E) m W % n8 D6 E9 A: |, H-[# F7 A # box {float: Left; width: 100px; margin: 0 0 0 100px; // In this case, ie will generate a 200px distance display: inline; // make floating ignore} 0 U, H * _ % v $ W/H )_ 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 ); # U1 {% T5 @ 4/|! /&]; I7 y 4 z7 x $ L4 c) e! P # box {display: block; // The embedded element can be simulated as the block element display: inline; // the result of the same row arrangement is dilay: Table; '['C % G, V9 E : S % G2 |-H; x $ w'y2 V9 O ;~ 5 questions about IE and width and height & Y: J3 R4 F +/1 A: _-H (v, J, O5 G-V3 Q * @ 0 J5 g/I; M3 Y. O 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, * a # V % G1 L-Z + P S9 t 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. 4 L-R % P &? 6 Q: N2 L For example, to set a background image, the width is important. To solve this problem, you can: 0 w. p'a5 H4 K # {# box {width: 80px; Height: 35px;} HTML> body # box {width: auto; Height: auto; Min-width: 80px; min-Height: 35px ;} 0 K1 B U $ t! J8 A; U6 ^! R. s) e $ s; B * X7 o ,_ 6. The minimum page width is $ K. K4 M/I 'm2 v * a, X 2 '. G, L * D * I, d 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, * J'x. z5 J6 I $ D, which uses width as the minimum width. To enable this command to be used on IE, you can place <div> under the <body> label and specify a class for div: ) E % Y, _ & W (x) w9'; O) D. Then CSS is designed as follows: # D) Y4 ^ + B # e # K % T5 o' r! K:/# container {Min-width: 600px; width: expression (document. Body. clientwidth <600? "600px": "Auto ");} 4 D * '9 A8 Q5 Q6 N $} The first Min-width is normal, but the width of row 2nd uses JavaScript, which is recognized only by IE, this will also make your HTML documents less formal. It actually achieves the minimum width through javascript judgment. 'E7 S % E-x ^ 1 s '_! ' 9 o-g/J8 M, L, Q: R (G & T7 i7 clear floating $ C & C5 F9 M8 [. S -~ + V 2 G9 B1 i7 T3 u'e. hackbox {display: Table; // display the object as a table at the block element level} Or. hackbox {clear: Both;} 'd # C & C * K8 W! D Or add: After (pseudo object) to set the content after the object, which is usually used with content. ie does not support this pseudo object, not supported by IE browsers ,) g3 x $ M: L * K % P % ';/ So it does not affect IE/win browsers. This is the most troublesome ...... # Box: After {content: "."; display: block; Height: 0; clear: Both; visibility: hidden ;} 1 T7 Q * G7 C3 L; F; G: S v/L4 | & K * E; j7 n )~ 8 n 8 DIV floating ie text produces 3 pixel bug ! T5 M/H9 E6? 4 f; ^ "f I/[9 E (Y + B 5 C/] $ Y8 '0 N5 A # I * t (the object on the left of N6 y floats, and the left margin of the outer patch is used to locate the object on the right, the text in the right object is 3 px away from the left. 7 |: G-Q % P # T) q % m'n; y "z' B & L7 u8 o! V4}/u7 U1 x # Box {float: Left; width: 800px; }# left {float: Left; width: 50% ;}# right {width: 50% ;} * html # Left {margin-Right:-3px; // This sentence is critical} 8 B o8 S * L3 H5 g HTML code <Div id = "box"> <Div id = "Left"> </div> <Div id = "right"> </ div> </div> % F6 | 4 R-I3 | T, t * N, k (r J5 _ 'e7 B0 d 9 attribute selector (this is not compatible, it is a bug for hiding CSS 'n! H u (H5 ^/} 2 t : M6 F1 _ # R. [; '& R "B P [ID] {} Div [ID] {}. U9 I: D8 A & Y * ^ %/9 {& T This is hidden for versions earlier than ie6.0 and ie6.0. ff and opera function 7 [, C * _. e # K % A5 y/J2 R6 Z There is a difference between the property selector and the Child selector. The range of the Child selector is reduced in the form, and the range of the property selector is relatively large, such as in P [ID, all P tags have IDs in the same style. $ B 'U "G. | 3 _ 8 S5 Q7 ^: o n; V * O, L1 ^-J0 ~ % J/h (J4 o10 ie hide-and-seek Problem # T2 H1 A1 }! H x $ y! B! } 8'7 q u! P When the DIV application is complicated, there are some links in each column. When the DIV application is complicated, it is prone to the "hide and seek" issue. ! A # G! I: f8', M % ~ 'N5 U1 {some content cannot be displayed. When you select this area, the content is indeed displayed on the page. # D/y! ^ % U & P5 R5 [% Z $ K9 P Solution: Use the line-height attribute for # layout or use fixed height and width for # layout. The page structure should be as simple as possible. 'N4 Y2 J) [1] 9 _! V3 t)} 9 o) G # K2 { 11 highly unsuitable /F. {8? * F6 C 'a7 K. ^: r1 F/E0 x *] 2 R & ^-P! O7 X5 d The height mismatch means that the height of the outer layer cannot be automatically adjusted when the height of the inner layer object changes, especially when the inner layer object uses ) | (P6 I * @ 2 O; V2 vmargin or paddign. /C9 D/C1 B $ m u. N0 [Example: 7 A * Q: A * y7 O) Q5 ^ 7g // <Div id = "box"> 3 J! F # E8 [(S1} <p> content in the p object </P> # V4 w'u0 e $ o "R % x, K: j9 F </div> 4 Q4 ^ 5 N3 s! G % G CSS: # box {background-color: # Eee;} 0 o T6 M-L $ x * B # Box P {margin-top: 20px; margin-bottom: 20px; text-align: center;} $ p $ H5 ~ 2 T1 [& M/} 3 x % Z9 x Solution: Add two empty Div objects to the upper and lower sides of the P object. CSS code:. 1 {Height: 0px; overflow: hidden;} or add the border attribute to the div. 8]:/0 @ $ N5 n! M/F1 e "T6 T, U6 n |