


Compatibility processing points
1. DOCTYPE affects CSS processing
2. FF: After setting padding, the div will increase height and width, but IE does not, so you need to use !important to set an additional height and width
3. FF: supports !important, but IE ignores it. You can use !important to set a special style for FF
4. Vertical centering problem of div: vertical-align:middle; Increase the line spacing to the same height as the entire DIV line-height: 200px; Then insert the text and it will be vertically centered. The disadvantage is that the content must be controlled not to wrap.
5. The BOX model in mozilla firefox and IE is inconsistent in interpretation, resulting in a 2px difference. Solution:
div{margin :30px!important;margin:28px;}
Note that the order of these two margins must not be reversed, !important this attributeIE cannot recognize it, but other browsers can be identified. So it is actually interpreted like this under IE:
div{maring:30px;margin:28px}
If you repeat the definition, it will be executed according to the last one, so you cannot just write margin:XXpx!important ;
Browser differences
1. Indentation problem of ul and ol lists
When eliminating the indentation of ul, ol and other lists, the style should be written as: list-style:none;margin:0px;padding:0px;
The margin attribute is valid for IE, and the padding attribute is valid for FireFox.
[Note] It has been verified that in IE, setting margin:0px can remove the upper, lower, left and right indents, blanks, and list numbers or dots of the list. Setting padding has no effect on the style; in Firefox, setting margin :0px can only remove the top and bottom spaces. Setting padding:0px can only remove the left and right indents. You must also set list-style:none to remove list numbers or dots. In other words, in IE, only margin:0px can be set to achieve the final effect, while in Firefox, margin:0px, padding:0px and list-style:none must be set at the same time to achieve the final effect.
2. CSS transparency issue
IE: filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=60).
FF:opacity:0.6.
[Note] It is best to write both and put the opacity attribute below.
3. CSS rounded corners problem
IE: Versions below ie7 do not support rounded corners.
FF: -moz-border-radius:4px, or -moz-border-radius-topleft:4px;-moz- border - radius-topright:4px;-moz-border-radius-bottomleft:4px;-moz-border-radius-bottomright:4px;.
[Note] The rounded corner problem is a classic problem in CSS. It is recommended to use the JQueryframework set to set the rounded corners, leaving these complex issues to others to think about. However, jQuery's rounded corners only support the rounded corners of the entire area and do not support the rounded corners of the border. However, the rounded corners of this border can be achieved through some simple means. I will introduce it next time.
4. cursor:hand VS cursor:pointer
Problem description: Firefox does not support hand, but IE supports pointer, both are hand instructions.
Solution: Use pointer uniformly.
5. Different definitions of font size
The definition of font size small is different. It is 13px in Firefox and 16px in IE. The difference is quite big.
Solution: Use the specified font size such as 14px.
Between divs and divs of multiple elements (picturesor links) arranged side by side, spaces and carriage returns in the code will be ignored in Firefox, but will be displayed by default in IE is space (about 3px).
6. CSS double-line bump border
IE: border:2px outset;.
FF: -moz-border-top-colors: #d4d0c8 white;-moz-border-left-colors: #d4d0c8 white;-moz-border-right-colors:#404040 #808080;-moz-border- bottom-colors:#404040 #808080;
Browser bug
1. IE double margin bug
The margin set for a div set to float under IE will be doubled. This is a bug that exists in ie6.
Solution: Add display:inline; inside this div
For example:
The corresponding css is
The following is the content of quote:
#IamFloat{ float:left; margin:5px;/*IE下理解为10px*/ display:inline;/*IE下再理解为5px*/ } #IamFloat{ float:left; margin:5px;/*IE下理解为10px*/ display:inline;/*IE下再理解为5px*/ }
There are too many problems in CSS, even the same CSS definition The display effects in different page standards are different. A suggestion that is in line with development is that the page should be written using standard XHTML standards, with less use of tables, and CSS definitions should be based on the standard DOM as much as possible, taking into account mainstream browsers such as IE, Firefox, and Opera. In many cases, the CSS interpretation standards of FF and Opera are closer to the CSS standards and more normative.
2. IE selector space BUG
Today when I was setting the first character style for the blog paragraph style, I discovered that a space can also invalidate the style.
Please look at the following code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="//www.w3.org/1999/xhtml"> <head> <title></title> <style type="text/css"> <!-- p{font-size:12px;} p:first-letter{font-size:300%} --> </style> </head> <body>
To the world, you are one person; but to someone, you are his entire world. Even if you are sad, don't frown, because you don't know who will fall in love with your smile.
The above is the detailed content of Introduction to multi-browser compatibility issues and solutions using CSS. For more information, please follow other related articles on the PHP Chinese website!

If you've ever had to display an interactive animation during a live talk or a class, then you may know that it's not always easy to interact with your slides

With Astro, we can generate most of our site during our build, but have a small bit of server-side code that can handle search functionality using something like Fuse.js. In this demo, we’ll use Fuse to search through a set of personal “bookmarks” th

I wanted to implement a notification message in one of my projects, similar to what you’d see in Google Docs while a document is saving. In other words, a

Some months ago I was on Hacker News (as one does) and I ran across a (now deleted) article about not using if statements. If you’re new to this idea (like I

Since the early days of science fiction, we have fantasized about machines that talk to us. Today it is commonplace. Even so, the technology for making

I remember when Gutenberg was released into core, because I was at WordCamp US that day. A number of months have gone by now, so I imagine more and more of us

The idea behind most of web applications is to fetch data from the database and present it to the user in the best possible way. When we deal with data there

Let's do a little step-by-step of a situation where you can't quite do what seems to make sense, but you can still get it done with CSS trickery. In this


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

WebStorm Mac version
Useful JavaScript development tools

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.

Notepad++7.3.1
Easy-to-use and free code editor