The default CSS settings of IE and FireFox are different.

Source: Internet
Author: User

This is a development record and will be updated in the future.
The first difference is the difference between the margin and padding of each element:
Let's set it

Margin: 0;
Padding: 0;

The second difference:
Different Background-Attachment


IE is fixed by default, while Firefox is scroll by default;

Summarized from other points:

Firefox and IE have different identification of some CSS styles.

The default padding values of UL and ol are different. In Firefox, the default value of padding-left is about 40 PX, while that of IE is 0. Generally, UL {margin: 0; padding: 0;} solves most problems.

Spaces and carriage returns in the code of multiple elements (images or links) in the parallel arrangement may cause gaps between elements, which are different in Firefox and IE, IE (about 8px) and Firefox (about 4px ).

 

The compatibility with nonstandard code is different. The closed symbols missed in IE do not affect the display, and Firefox will form a disordered layout.

 

Strict parsing of the width and height of Firefox will result in an image or table that does not match the setting (beyond.

 

The DIV with an undefined ID is related to other settings in the DIV property in IE, and the position in Firefox is related to the position of the DIV in the file, followed by the previous Div.

 

The DIV set to float doubles the margin set in IE, especially the margin-left, which is a bug in IE6. The solution is to add the display: inline In the div;

 

If the content is added dynamically, it is best not to define the height. The browser can automatically scale. However, it is best to set the height of static content. (It seems that sometimes it will not be automatically pushed down and I don't know what's going on)

 

FF: When Div sets margin-left and margin-Right to auto, it is already centered, and IE is not working. In IE, text-align: center is set, but not in ff. Therefore, you must set both of them.

FF: After padding is set, the DIV will increase the height and width, but IE will not, so we need to use it! Set one more height and width for important.

FF "! Important will automatically give priority to resolution, but IE will ignore it.
. TABD {
Background: URL (/RES/images/up/tab1.gif) No-repeat 0px 0px! Important;/* style for FF */
Background: URL (/RES/images/up/tab1.gif) No-repeat 1px 0px;/* style for IE */
}

FF: adds a border and a background color to the link. You must set display: block and float: left to avoid line breaks.

2. CSS style for Firefox IE6 IE7
Most of them are used now! Important comes to hack. It can be displayed normally for IE6 and Firefox tests,
But IE7! Important can be correctly explained, and the page will not be displayed as required! Find a needle
The good hack Method for IE7 is to use "* + html". Now you can use IE7 to browse it. It should be okay.
You can write a CSS file as follows:

#1 {color: #333;}/* Moz */
* Html #1 {color: #666;}/* IE6 */
* + Html #1 {color: #999;}/* IE7 */
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.

3. When multiple layers are nested in firefox, the background is not displayed when the floating outer layer is set in the inner layer.
This is mainly because the height of the outer layer changes to 0 in firefox after the inner layer is set to float. Therefore, an additional layer should be embedded between the outer layer and the inner layer to set the float and width.
Degrees, and then set the background for this layer (I heard there are other methods, I feel this method is better)

4. Attribute selector (this is incompatible and is a bug in hiding css.
P [id] {} div [id] {}
This is hidden for versions earlier than IE6.0 and IE6.0. It is used by FF and OPera.
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.

5. nested DIV: the height of the parent DIV cannot be automatically changed based on the Child DIV.

<Div id = "parent">
<Div id = "content"> </div>
</Div>

When the Content is too large, even if the parent is set to a height of 100% or auto, it cannot be automatically stretched in different browsers. Solution

<Div id = "parent">
<Div id = "content"> </div>
<Div style = "font: 0px/0px sans-serif; clear: both; display: block"> </div>
</Div>

A space with a height of 1 is generated at the bottom of the layer to solve this problem.

Reprinted from: http://zhtphoenix.javaeye.com/blog/262595

 


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.