CSS compatibility highlights: doctype affects CSS Processing
FF: When Div sets margin-left and margin-Right to auto, it is already centered, and IE is not working.
FF: When you set text-align for the body, you must set margin: auto (mainly margin-left, margin-Right) for the DIV to be centered.
FF: Yes! Important, ie is ignored, available! Important sets a special style for FF
FF: After padding is set, the DIV will increase the height and width, but IE will not, so we need to use it! Important has one more height and width, for example, height: 30px! Important;/* this height style only works for FF */
Vertical center problem of Div: vertical-align: middle; Increase the line spacing to the same height as the entire Div line-Height: 200px; then insert the text to the vertical center. The disadvantage is that you need to control the content rather than line feed.
Cursor: pointer can display the cursor finger shape in IE ff at the same time, hand only ie Can
FF: adds a border and a background color to the link. You must set display: block and float: left to avoid line breaks. Refer to menubar to set the height of a and menubar to avoid misplacement of the bottom side. If no height is set, you can insert a space XHTML + CSS compatibility solution small set in menubar.
There are many benefits to using the XHTML + CSS architecture, but there are also some problems. Whether it is because I am not skilled or have unclear ideas, I will first write down some of my problems below.
1. The box model interpretation in Mozilla Firefox and IE is inconsistent, resulting in a 2px difference. solution:
Div css xhtml xml example source code [www.52css.com]
Div {margin: 30px! Important; margin: 28px ;}
Note that the order of the two margin entries must not be reversed. According to Alibaba Cloud! The important attribute ie cannot be identified, but other browsers can. So in IE, it is actually explained as follows:
Div css xhtml xml example source code [www.52css.com]
Div {maring: 30px; margin: 28px}
If the definition is repeated, execute the last statement. Therefore, you cannot write only margin: xxpx! Important;
2. The box interpretations of ie5 and IE6 are inconsistent.
In ie5, div {width: 300px; margin: 0 10px 0 10px;} Div width is interpreted as 300px-10px (right fill)-10px (left fill) in the end, the DIV width is 280px, while in IE6 and other browsers, the width is calculated based on 300px + 10px (right filling) + 10px (left filling) = 320px. In this case, we can make the following changes:
Div css xhtml xml example source code [www.52css.com]
Div {width: 300px! Important; width/**/: 340px; margin: 0 10px 0 10px}
Note: Here/**/supports ie5 and FF, but does not support IE6.
3. UL labels have padding values by default in Mozilla, while in IE, only margin has a value, so we define it first.
Div css xhtml xml example source code [www.52css.com]
Ul {margin: 0; padding: 0 ;}
Most problems can be solved.
4. For the script, the language attribute is not supported in xhtml1.1. You only need to change the code
Div css xhtml xml example source code [www.52css.com]
<SCRIPT type = "text/JavaScript">
This is OK. Try it on your own ~ Pai_^