An explanation of CSS compatibility

巴扎黑
Release: 2017-07-18 18:13:29
Original
1674 people have browsed it

Previous words

For front-end engineers, one problem they don’t want to face but have to face is compatibility. A few years ago, dealing with compatibility usually involved dealing with the compatibility of lower versions of IE browsers. In recent years, with the development of mobile terminals, engineers also need to pay attention to mobile phone compatibility. This article will introduce CSS compatibility in detail

Weird mode problem: If you omit the DTD declaration, Firefox will still parse the web page according to the standard mode, but the weird mode will be triggered in IE. In order to avoid weird patterns causing us unnecessary trouble, it is best to develop a good habit of writing DTD declarations.

2. IE6 double margin problem: Under IE6, if an element is floated and margin-left or margin-right is set at the same time, the margin value will be doubled. For example:

HTML:


Box model attribute

【 Width/height】

(全兼容)
width
height

(IE6-不支持)
min-width
max-width
min-height
max-height
Copy after login

【Padding】

padding
Copy after login

【Border】

(全兼容)
border
border-width
border-color
border-style

(IE8-不支持)
border-radius

(IE10-不支持)
border-image
border-image-source
border-image-slice
border-image-width
border-image-outset
border-image-repeat

(只有firefox支持,需要添加-moz-前缀)
border-colors
Copy after login

【Outer margin】

(全兼容)
margin

(IE不支持,且需要添加webkit或moz前缀)
margin-start
margin-end

(只有chrome和safari支持,且需要添加webkit前缀)-webkit-margin-before-webkit-margin-after
Copy after login

【Outline】

(IE7-不支持)
outline
outline-width
outline-color
outline-style

(IE不支持)
outline-offset
Copy after login

【box-sizing】

[Note] Only firefox supports the padding-box attribute value

(IE7-不支持)
box-sizing
Copy after login

Layout class attribute

[display]

 [ Note] IE7-the browser does not support the table class attribute value

(全兼容)
display
Copy after login

[Floating]

(全兼容)floatclear
Copy after login

[Positioning]

[Note] IE6-does not support fixed positioning: fixed

(全兼容)
position
left
right
top
bottom
z-index
Copy after login

[overflow related]

<span style="color: #000000;">(全兼容)
overflow<br>overflow-x<br>overflow-y<br>clip<br>visibility<br><br>(IE不支持)<br>resize</span>
Copy after login

[flex]

(IE9-不支持)
flex-direction
flex-wrap
flex-flow
justify-content
align-items
align-content
align-self
flex-basis
flex-grow
flex-shrink
flex
order
Copy after login

【Multi-column layout】

(IE10+和chrome浏览器支持标准写法,firefox、safari浏览器及移动端android、IOS需要添加前缀)
column-width
column-count
column-gap
column-rule
column-span(firefox不支持该属性)
columns

(只有firefox支持带前缀的column-fill属性)
column-fill
Copy after login

【grid】

(IE9-不支持,IE10+需要添加-ms-前缀,android4.4.4-不支持,IOS10.2-不支持)
grid-template-rows
grid-template-columns
grid-template-areas
grid-column-gap
grid-row-gap
grid-gap
grid-row-start
grid-row-end
grid-row
grid-column-start
grid-column-end
grid-column
grid-area
grid-auto-flow
grid-auto-rows
grid-auto-columns
justify-items
justify-self
align-items
align-self
Copy after login

Text class Attribute

【Font font】

(全兼容)
font
font-family
font-size
font-style
font-variant
font-weight
line-height
@font-face
Copy after login

【First line indent text-indent】

(全兼容)
text-indent
Copy after login

【Alignment】

[Note] IE7-The percentage value of vertical-align in the browser does not support decimal line height

--align

(safari浏览器、IOS、androis4.4-浏览器不支持)
text-align-last
Copy after login

[Interval]

(全兼容)
word-spacing
letter-spacing
Copy after login

【Case text-transform】

(全兼容)
text-transform
Copy after login

【Underline text-decoration】

(全兼容)
text-decoration
Copy after login

【White-space】

 [Note] IE7-browser does not support the two attribute values ​​​​of pre-line and pre-wrap

(全兼容)
white-space
Copy after login

[Line break]

 [ Note 1] W3C recommends using overflow-wrap to replace word-wrap

[Note2] Mobile terminals currently do not support the word-break attribute valuekeep-all 

--wrap
Copy after login

【Text direction】

-webkit--
Copy after login

【Text-overflow text-overflow】

(全兼容)
text-overflow
Copy after login

【Text-shadow text-shadow】

(IE9-不支持)
text-shadow
Copy after login

Modification class attribute

【Background】

(全兼容)
background
background-color
background-image
background-repeat
background-position

(IE8-不支持)
background-attachment
background-clip
background-size
Copy after login

【Foreground and Transparency】

(全兼容)
color

(IE8-不支持)
opacity
Copy after login

【Color Mode】

 [Note] IE7-does not support color:transparent, but does support background-color: transparent and border-color: transparent

-
Copy after login

【cursor】

 [Note]IE7-does not support extended styles

(全兼容)
cursor
Copy after login

【Transition】

(IE9-不支持,safari3.1-6、IOS3.2-6.1、android2.1-4.3需要添加-webkit-前缀)
transition-property
transition-duration
transiton-timing-function
transition-delay
transition
Copy after login

【Transform】

(IE9-不支持,safari3.-、android2.-.、IOS3.----
Copy after login

【Gradient】

  IE9-不支持,safari4-5、IOS3.2-4.3、android2.1-3只支持线性渐变,且需要添加-webkit-;safari5.1-6、IOS5.1-6.1、android4-4.3支持线性和径向渐变,且需要添加-webkit-
Copy after login

【animation】

(IE9-不支持;safari4-8、IOS3.2-8.4、android2.1-4.4.4需要添加-webkit-前缀)
animation
animation-name
animation-duration
animation-timing-function
animation-delay
animation-iteration-count
animation-direction
animation-play-state
animation-fill-mode
Copy after login

【Blending mode】

(IE浏览器、android4.4-不支持,safari和IOS需要添加-webkit-前缀)
mix-blend-mode
background-blend-mode
isolation
Copy after login

【Filter】

(IE浏览器及android4.3-浏览器不支持,android4.4+需要添加-webkit-前缀)
filter
Copy after login

【Reflection box-reflect】

Only chrome and safari browsers support it, and the -webkit- prefix needs to be added

【will-change】

(IE13+、chrome49+、safari9.1+、IOS9.3+、Android52+)
will-change
Copy after login

Other class attributes

[Table]

(全兼容)
border-collapse
table-layout
caption-side

(IE7-不支持)
border-spacing
empty-cells
Copy after login

[Page]

(全兼容)
page-break-after
page-break-before
page-break-inside

(IE7-不支持)
orphans

(IE及手机端不支持)
windows
Copy after login

[Selector]

(全兼容)
通配选择器   *元素选择器   div
类选择器     .box
ID选择器     #box
后代选择器   div a
分组选择器   h1,p

(IE6-不支持)
属性选择器    h1[class]
子元素选择器  ul > li
相邻兄弟选择器 div + p

(IE7-不支持)
通用兄弟选择器 div ~ p
Copy after login

[Pseudo-class]

(全兼容)
:link
:visited

(IE6-不支持给<a>以外的其他元素设置伪类)
:hover
:active  

(IE7-不支持)
:focus
:lang() 

(IE8-不支持)
:target
:enabled   
:disabled   
:checked :nth-child(n)
:nth-last-child(n)
:first-child
:last-child
:only-child
:nth-of-type(n)
:nth-last-of-type(n)
:first-of-type
:last-of-type
:only-of-type
:root
:not
:empty
:target
Copy after login

[Pseudo-element]

(只有当选择器部分和左大括号之间有空格时,IE6-浏览器才支持)
:first-letter
:first-line

(IE7-不支持)
:before
:after

(IE8-不支持)
::selection
Copy after login

【Keyword】

(IE7-浏览器不支持)
inherit

(IE浏览器不支持)
initial

(IE不支持,safari9-不支持,ios9.2-不支持,android4.4.4-不支持)
unset
all

(只有safari9.1+和ios9.3+支持)
revert
Copy after login

【calc】 

 [Note] android4.4-4.4.4 only supports addition and subtraction. IE9 does not support backround-position

(IE8-、safari5.1-、ios5.1-、android4.3-不支持)
calc
Copy after login

【Unit】

(全兼容)
pxincm
mm
q
pt
pc
em
ex
ch

(IE8-不支持)
rem

(IE8-浏览器不支持,IOS7.1-不支持,android4.3-不支持,对于vmax所有IE浏览器都不支持)
vh
vw
vmin
vmax
Copy after login

The above is the detailed content of An explanation of CSS compatibility. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
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 admin@php.cn
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!