What are the ways to write CSS that are compatible with IE?

醉折花枝作酒筹
Release: 2023-01-06 11:16:02
Original
3279 people have browsed it

The CSS writing methods compatible with IE are: 1. Add "-" or "_" in front of the attribute, and the writing method is "_attribute: attribute value"; 2. CSS conditional comments, the syntax "".

What are the ways to write CSS that are compatible with IE?

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

1. Hack

Writing method:

.demo {
margin-left:30px; 
_margin-left:20px; 
}
Copy after login

Advantages:

1. Embedded in CSS, it is very convenient when writing

2. Embedded in CSS, it will not generate more HTTP requests

Disadvantages:

1. Not unified in one module, later maintenance and modification will be troublesome

2. Even if this writing method does not work, the browser will load the code and waste resources

2. CSS conditional comments

Writing method:

Copy after login

Advantages :

1. The code is independent, which is beneficial to later maintenance

2. For browsers where the code does not work, this code is just an ordinary comment and will not be loaded when they load it. Load its content and save resources

Disadvantages:

1. A new HTTP request is added, which undoubtedly increases the pressure on the old version of IE browser.

Extension:

HTML tag conditional comments

   




Copy after login
.ie6 .demo {  
    margin-left: 20px;
      }
Copy after login

This method can separate the code into a separate module and will not add a new HTTP request. Currently used more.

Recommended learning: css video tutorial

The above is the detailed content of What are the ways to write CSS that are compatible with IE?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!