A powerful tool to solve the layout difference between IE and Mozilla: "! Important"

Source: Internet
Author: User
Designers of div + css web page layout are often troubled by a problem.
The effect displayed in IE and other browsers (Mozilla, Opera, etc.) is often 2px different.
This is because of the bug in IE's interpretation of the distance between boxes. A tip to help us find a solution: Use! Important.
! Important is a syntax defined in CSS1 to improve the application priority of a specified style rule.
Syntax format {sRule! Important} is written at the end of the definition, for example:
Box {color: red! Important ;}
The most important thing is that IE does not support this syntax all the time, but other browsers do. We can use this to define different styles for IE and other browsers. For example:
. Colortest {
Border: 20px solid #000! Important;
Border: 20px solid # CCC;
Padding: 30px;
Width: 300px;

It can be understood when browsing in Mozilla! Indicates the priority of important, so the color of #000 is displayed;
Cannot be understood when browsing in IE! The priority of important, so the # CCC color is displayed.
You can see, use! Important, we can set different styles for IE and non-IE browsers, as long as it is added after the style of the non-IE browser! Important.
! Important must be a powerful CSS Layout Tool. Remember it, master it, and use it properly!

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.