search
HomeWeb Front-endHTML TutorialDIV CSS solves IE6, IE7, IE8, FF compatibility issues_html/css_WEB-ITnose

1. Compatibility issues under ie8, this is best dealt with, just convert it to ie7 compatibility. Add the following code to the head, and as long as it is compatible under IE7, it will also be compatible under IE8

2. Float floating causes double margin problem under IE6. This is the most common and best to deal with. !important solution, such as

margin-left:10px! important;/*Under IE7, IE8, FF it is 10PX*/;

margin-left:5px;/*The attribute written under IE6 is 5PX, but it is displayed as 10px

3. Clear the block display. This can solve the block caused by floating. After the block is formed, when the DIV background is filled with color or picture, the background will be disconnected or a small block will appear. This kind of compatibility does not appear too often. I have only encountered it twice so far. The method is to write a display: block or other attributes in the CSS where the compatible DIV appears. I don’t know what it means in Chinese. I am English Poor, but it can achieve the desired effect, 6 e" Z e% |8 G# |

4. Many friends will see it when DIV CSS, but it is fine in several IE browsers. But something went wrong in FF. Using !important will make IE7 incompatible, which is a headache. I was wondering if there is any way to operate it only in FF. I have used this method, and it seems to be unsatisfactory. That is to add symbols in front of the attributes, such as: *, &, ¥, #, @, ?,. The attributes with symbols are only recognized by IE browsers, but not by FF. The method is as follows (note the attributes with symbols and attributes without symbols) The order of the attributes)

height:100px;/*The height of 100 is displayed under FF*/

height:120px;/*The height of 120 is displayed under IE678*/

5. Sometimes, during layout, it is found that a DIV is floating, and the next DIV is supposed to be displayed below, but ends up above it. This situation usually occurs under FF, and it can be solved. The way is to clear the float, add a DIV below the DIV that has been set to float, and write clear:both; in the CSS as follows

6. Then there is centering Problem, this problem occurs a lot for novices. The main reason is that they don’t understand the box model well and don’t memorize the box model. If you find that your page does not have a game, I now know that there are several reasons: 1. One is that there is no box. , which is the big DIV after BODY that holds all the DIVs together. You didn't write it. 2. You did, but the width didn't use absolute width: instead, it used a relative width. In the middle of the game, absolute width must be used. . -

7. Extension: If I want to achieve three different effects under IE6, IE7, and FF when designing, such as red background under IE6, blue under IE7 and green under FF, here, I have tried it myself, and it works, using a compatible method (pay attention to the order, you can understand it better) 7 L& t- o7 k- a1 I

background:red;/*The red color shown in FF*/<.>

background:blue !important;/*The blue color shown below IE7*/

background:green;/*The green color shown below IE6*/

Here, I I want to say that although compatibility brings you a lot of depression and upsets, at the same time, after you do it too much, you will find that compatibility can sometimes satisfy you with many difficult-to-achieve effects, just like the last one. To achieve that kind of effect, you don’t need to use compatibility methods, then you can use JS. You also have to think about the differences between FF and IE for JS. Of course, I don’t know how to use JS compatibility. I haven’t studied it. For the future, let’s learn CSS DIV first.

Do more, practice, and always keep the box model in your mind. Only then will you become proficient and able to use it freely. Only then will you naturally know where there are compatibility issues when doing it. Just do it before testing. Troubleshoot the most common compatibility issues.

Statement
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 admin@php.cn
HTML: The Structure, CSS: The Style, JavaScript: The BehaviorHTML: The Structure, CSS: The Style, JavaScript: The BehaviorApr 18, 2025 am 12:09 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The Future of HTML: Evolution and Trends in Web DesignThe Future of HTML: Evolution and Trends in Web DesignApr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML: Is It a Programming Language or Something Else?HTML: Is It a Programming Language or Something Else?Apr 15, 2025 am 12:13 AM

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML: Building the Structure of Web PagesHTML: Building the Structure of Web PagesApr 14, 2025 am 12:14 AM

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

From Text to Websites: The Power of HTMLFrom Text to Websites: The Power of HTMLApr 13, 2025 am 12:07 AM

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

Understanding HTML, CSS, and JavaScript: A Beginner's GuideUnderstanding HTML, CSS, and JavaScript: A Beginner's GuideApr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The Role of HTML: Structuring Web ContentThe Role of HTML: Structuring Web ContentApr 11, 2025 am 12:12 AM

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor