Get the App
SLTechnology News&Howtos  ›  Development  › 

How to deal with the compatibility problem of CSS browser

Shulou Source: shulou.com Published: 2022-06-03 09:47:58 09月19日 Update

Editor to share with you how to deal with CSS browser compatibility issues, I believe most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's learn about it!

What is a browser compatibility issue?

Understanding the browser kernel

Browser type kernel js engine

IETridentjscript

FirefoxGeckoTraceMonkey

ChromeWebKit,BlinkV8

SafariWebKitSquirrelFishExtreme

OperaPrestoCarakan

The solution to the compatibility problem of css browser

1. Using cssHack to solve compatibility issues

Browsers may encounter unrecognized code when reading css code, and there are usually two reasons for this:

1. There is something wrong with the code itself, such as: bg:red,bg is not a valid css attribute

two。 The code is fine, but the kernel of the browser cannot recognize it, such as box-sizing:border-box. There is no problem with this code itself, but because it uses the attribute box-sizing of css3, it will not be recognized in some browsers with lower versions of the kernel.

In short, what does a browser do when it encounters unrecognized code? Unlike back-end languages such as java and C #, the browser does not abort the execution of the program, but immediately skips the unrecognized code and continues to execute the rest of the code as if it were not seen. Just like the following example:

.main {

The color1:red;/* code cannot be recognized by the browser, so the browser will assume that the code does not exist * /

Color:green

}

The above is all the contents of the article "how to deal with CSS browser compatibility issues". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Browsers browsing code issues compatibility kernel articles processing content attributes different effective less examples reasons most engines ideas solutions time Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Linux Shulou Technology Apple Shulou Information