Home Web Front-end HTML Tutorial (Experience) DIV CSS solves IE6, IE7, IE8, FF compatibility issues_html/css_WEB-ITnose

(Experience) DIV CSS solves IE6, IE7, IE8, FF compatibility issues_html/css_WEB-ITnose

Jun 24, 2016 pm 12:30 PM

(Experience) DIV CSS solves IE6, IE7, IE8, FF compatibility issues
Let me talk about it. I have been working on DIV CSS for almost a year, and I have accumulated a lot of compatibility solutions. To solve the problem, I will only talk about the current mainstream ones here, (IE6, IE7, IE8, FF) and have not studied the others
1. Compatibility issues under ie8, this is best dealt with, just convert it to ie7 compatibility. . Add the following code to the header, 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 solves it, such as
margin-left:10px !important;/*IE7,IE8,FF The bottom is 10PX*/;
margin-left:5px;/*The attribute written under IE6 is 5PX, but what is displayed is 10px

3. Clear the block display, this can solve the problem caused by floating Blocks, after forming blocks, 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. It works fine in several IE browsers, but in FF Something went wrong. Using !important will make IE7 incompatible. It's a headache. I'm wondering if there is any way to operate it only under FF. I have used this method and it seems to be unsatisfactory. It is in the properties. Add symbols in front, such as: *, &, ¥, #, @, ?, . The attributes with symbols are only recognized by IE browsers, but not by FF. The method is as follows (note the difference between signed attributes and unsigned attributes. Order)
height:100px;/*Display 100 height under FF*/
height:120px;/*Display 120 height under IE678*/

5. Sometimes, in the layout At that time, I found that a DIV was floating. The next DIV was supposed to be displayed below, but it ended up above. This situation usually occurs below FF. The solution is to clear the floating and set it after setting. Add a DIV below the floating DIV, and write clear:both; in the CSS as follows



6. Then there is the centering problem. This problem occurs a lot for novices. The main reason is that the box model I don’t understand it well enough and haven’t memorized the box model. If I find that your page has no center, I know now that there are several reasons: 1. One is that there is no box, which is the big DIV after the BODY that holds all the DIVs. , you didn’t write it. 2. You did, but the width did not use absolute width: instead, it used a relative width. If you want to use it, you must use absolute width. -

7. Extension: If I want to. When designing, three different effects appear under IE6, IE7, and FF. For example, the background is red under IE6, blue under IE7, and green under FF. Here, I have tried it myself, and it works, using compatible methods (pay attention to the order, You can understand it better). 7 L& t- o7 k- a1 I
background:red;/*red displayed in FF*/
background:blue !important;/*blue displayed below IE7*/
background:green;/*Green displayed below IE6*/

Here, I want to say that although compatibility brings you a lot of depression and makes people upset, at the same time, when you do long After that, you will find that compatibility can sometimes satisfy you with many difficult-to-achieve effects. Just like the last one, if you want to achieve that effect without using compatibility methods, then you can use JS. For JS, you also have to think about FF and FF. The difference under IE, of course, is that I don’t know the compatibility of JS. 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 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 admin@php.cn

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)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the purpose of the <progress> element? What is the purpose of the <progress> element? Mar 21, 2025 pm 12:34 PM

The article discusses the HTML &lt;progress&gt; element, its purpose, styling, and differences from the &lt;meter&gt; element. The main focus is on using &lt;progress&gt; for task completion and &lt;meter&gt; for stati

What is the purpose of the <datalist> element? What is the purpose of the <datalist> element? Mar 21, 2025 pm 12:33 PM

The article discusses the HTML &lt;datalist&gt; element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

What are the best practices for cross-browser compatibility in HTML5? What are the best practices for cross-browser compatibility in HTML5? Mar 17, 2025 pm 12:20 PM

Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.

What is the purpose of the <meter> element? What is the purpose of the <meter> element? Mar 21, 2025 pm 12:35 PM

The article discusses the HTML &lt;meter&gt; element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates &lt;meter&gt; from &lt;progress&gt; and ex

How do I use HTML5 form validation attributes to validate user input? How do I use HTML5 form validation attributes to validate user input? Mar 17, 2025 pm 12:27 PM

The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

What is the viewport meta tag? Why is it important for responsive design? What is the viewport meta tag? Why is it important for responsive design? Mar 20, 2025 pm 05:56 PM

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

What is the purpose of the <iframe> tag? What are the security considerations when using it? What is the purpose of the <iframe> tag? What are the security considerations when using it? Mar 20, 2025 pm 06:05 PM

The article discusses the &lt;iframe&gt; tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Apr 04, 2025 pm 11:54 PM

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

See all articles