CSS 兼容性和 Internet Explorer

http://msdn.microsoft.com/library/cc351024.aspx

 

CSS 兼容性和 Internet Explorer

隨着每個新版本的 Windows Internet Explorer 的發佈,對級聯樣式表 (CSS) 標準的支持也在穩步提高。 Internet Explorer 6 是第一個完全符合 CSS 級別 1 規範的 Internet Explorer 版本。 Windows Internet Explorer 8 完全符合 CSS 級別 2 修訂 1 (CSS 2.1) 規範,並支持某些 CSS 級別 3 (CSS 3) 的功能。

如果您的網站面向的瀏覽器包括早期版本的 Internet Explorer,則您需要知道這些版本符合的 CSS 級別規範。 本文簡述了各個最近的 Internet Explorer 版本的 CSS 合規性(包括 Internet Explorer 8 中提供的支持)。

注意 Internet Explorer 8 中新增的 CSS 功能僅當您的頁面在 IE8 模式(或更高版本)中呈現時可用。 通過在您頁面的標題部分中包含以下 meta 標記,可以確保您的頁面以 IE8 模式顯示:

<meta http-equiv="X-UA-Compatible" content="IE=8" />

有關文檔兼容性模式的更多信息,請參見“定義文檔兼容性”。

本文以 MSDN 上的 CSS 參考文檔(可能爲英文網頁)爲基礎且結構較爲鬆散。 本文包含以下各節:

簡介

每個表均列出了最近的 Internet Explorer 版本中分組 CSS 功能的支持狀態信息。 在每一節中,第一個表表示 CSS 2.1 或早期版本中引入的功能,第二個表表示萬維網聯合會 (W3C) 爲 CSS 3 規劃的功能。

單元格中的值“是”表示在相應版本的 Internet Explorer 中實現了該功能。

單元格中的值“部分”表示只在相應版本的 Internet Explorer 中部分實現了該功能。 有關更多信息,請單擊鏈接查看 MSDN 上該功能的參考頁。

單元格中的值“否”表示未在相應版本的 Internet Explorer 中實現該功能。

At 規則

CSS 2.1:

 Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
@charset
@import
@media
@page 部分 部分 部分 部分

CSS 3:

 Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
@font-face
@namespace

選擇器

元素選擇器

CSS 2.1:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
.value { sRules } (請參見注釋) 部分 部分 部分
#value { sRules } ID
E { sRules } 類型
* { sRules } 通用

註釋 在 Internet Explorer 7 之前的版本中,每個元素只能有兩個類選擇器。

CSS 3:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
ns|E { sRules } 已指定命名空間

屬性選擇器

CSS 2.1:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
[att=val] { sRules } 相等 [=]
[att] { sRules } 存在 []
[att|=val] { sRules } 連字符 [|=]
[att~=val] { sRules } 空白 [~=]

CSS 3:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
[ns|attr] { sRules } 已指定命名空間
[att^=val] { sRules } 前綴 [^=]
[att*=val] { sRules } 子字符串 [*=]
[att$=val] { sRules } 後綴 [$=]

連結符

CSS 2.1:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
E+F { sRules } 相鄰同級 (+)
E>F { sRules } 子級 (>)
EF { sRules } 後代

CSS 3:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
E~F { sRules } 常規同級 (~)

僞類

CSS 2.1:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
:active { sRules } :active 部分
:first-child { sRules } :first-child
:focus { sRules } :focus
:hover { sRules } :hover 部分 部分 部分
:lang(C) { sRules } :lang()
:link { sRules } :link
:visited { sRules } :visited
@page :first { sRules } @page :first
@page :left { sRules } @page :left
@page :right { sRules } @page :right

CSS 3:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
:root { sRules } :root
:nth-child() { sRules } :nth-child()
:nth-last-child() { sRules } :nth-last-child()
:nth-of-type() { sRules } :nth-of-type()
:nth-last-of-type() { sRules } :nth-last-of-type()
:last-child { sRules } :last-child
:first-of-type { sRules } :first-of-type
:last-of-type { sRules } :last-of-type
:only-child { sRules } :only-child
:only-of-type { sRules } :only-of-type
:empty { sRules } :empty
:target { sRules } :target
:not(X) { sRules } :not()
:enabled { sRules } :enabled
:disabled { sRules } :disabled
:checked { sRules } :checked
:indeterminate { sRules } :indeterminate
:default { sRules } :default
:valid { sRules } :valid
:invalid { sRules } :invalid
:in-range { sRules } :in-range
:out-of-range { sRules } :out-of-range
:required { sRules } :required
:optional { sRules } :optional
:read-only { sRules } :read-only
:read-write { sRules } :read-write

僞元素

CSS 2.1:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
:after { sRules } :after
:before { sRules } :before
:first-letter { sRules } :first-letter
:first-line { sRules } :first-line

CSS 3:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
::before { sRules } ::before
::after { sRules } ::after
::first-letter { sRules } ::first-letter
::first-line { sRules } ::first-line
::selection { sRules } ::selection
::value { sRules } ::value
::choices { sRules } ::choices
::repeat-item { sRules } ::repeat-item
::repeat-index { sRules } ::repeat-index

屬性

CSS 2.1:
  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
{ sRule!important  } !important 聲明 部分 部分 部分

列表

CSS 2.1:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
{ list-style : sStyle } list-style
{ list-style-image : sStyle } list-style-image
{ list-style-position : sStyle } list-style-position
{ list-style-type : sStyle } list-style-type 部分

顏色和背景

CSS 2.1:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
{ color : sColor } color
{ background : sBackground } background
{ background-attachment : sAttachment } background-attachment 部分 部分 部分
{ background-color : sColor } background-color
{ background-image : sLocation } background-image
{ background-position : sPosition } background-position 部分 部分 部分 部分
{ background-repeat : sRepeat } background-repeat

CSS 3:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
{ color-profile : sProfile } color-profile
{ rendering-intent : sIntent } rendering-intent
{ background : sBackground1,
sBackground2, etc. }
background (multiple)
{ background-clip : sClip } background-clip
{ background-origin : sOrigin } background-origin
{ background-break : sBreak } background-break
{ background-size : sSize } background-size

字體和文本

CSS 2.1:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
{ direction : sDirection } direction
{ font : sFont } font
{ font-family : sFamily } font-family
{ font-size : sSize } font-size
{ font-style : sStyle } font-style
{ font-variant : sVariant } font-variant
{ font-weight : sWeight } font-weight 部分 部分 部分 部分
 { letter-spacing : sSpacing } letter-spacing
 { line-height : sHeight } line-height
{ text-align : sAlign } text-align
{ text-decoration : sDecoration } text-decoration
{ text-indent : sIndent } text-indent
{ text-transform : sTransform } text-transform
{ unicode-bidi : sAlign } unicode-bidi
{ vertical-align : sAlign } vertical-align
{ white-space : sWrap } white-space 部分 部分 部分 部分
{ word-spacing : sSpacing } word-spacing 部分 部分 部分 部分

CSS 3:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
{ font-effect : sEffect } font-effect
{ font-emphasize : sEmphasize } font-emphasize
{ font-size-adjust : sSizeAdjust } font-size-adjust
{ font-smooth : sSmooth } font-smooth
{ font-stretch : sStretch } font-stretch
{ hanging-punctuation : sHangingPunctuation } hanging-punctuation
{ punctuation-trim : sTrim } punctuation-trim
{ ruby-align : sRubyAlign } ruby-align
{ ruby-overhang : sRubyOverhang } ruby-overhang
{ ruby-position : sRubyPlacement } ruby-position
{ ruby-span : sRubySpan } ruby-span
{ text-align-last : sAlignLast } text-align-last 部分 部分 部分 部分 部分
{ text-emphasis : sEmphasis } text-emphasis
{ text-justify : sJustify } text-justify
{ text-outline : sOutline } text-outline
{ text-overflow : sOverflow} text-overflow 部分 部分 部分 部分
{ text-shadow : sShadow } text-shadow
{ text-wrap : sWrap } text-wrap
{ word-break : sBreak } word-break 部分 部分 部分 部分 部分
{ word-wrap : sWrap } word-wrap
{ writing-mode : sFlow } writing-mode

生成的內容

CSS 2.1:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
{ content : sContent } content
{ counter-increment : sCounter } counter-increment
{ counter-reset : sCounter } counter-reset
{ quotes : sQuotes } quotes

邊框和佈局

CSS 2.1:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
{ border : sBorder } border
{ border-bottom : sBottom } border-bottom
{ border-bottom-color : sColor } border-bottom-color
{ border-bottom-style : sStyle } border-bottom-style
{ border-bottom-width : sWidth } border-bottom-width
{ border-collapse : sCollapse } border-collapse 部分 部分 部分 部分
{ border-color : sColor } border-color
{ border-left : sLeft } border-left
{ border-left-color : sColor } border-left-color
{ border-left-style : sStyle } border-left-style
{ border-left-width : sWidth } border-left-width
{ border-right : sRight} border-right
{ border-right-color : sColor } border-right-color
{ border-right-style : sStyle } border-right-style
{ border-right-width : sWidth } border-right-width
{ border-spacing : sSpacing } border-spacing
{ border-style : sStyle } border-style 部分 部分 部分
{ border-top : sTop } border-top
{ border-top-color : sColor } border-top-color
{ border-top-style : sStyle } border-top-style
{ border-top-width : sWidth } border-top-width
{ border-width : sWidth } border-width
{ caption-side : sLocation } caption-side
{ clear : sClear } clear
{ empty-cells : sEmptyCells } empty-cells 部分
{ float : sFloat } float
{ margin : sMargin } margin
{ margin-bottom : sHeight } margin-bottom
{ margin-left : sWidth } margin-left
{ margin-right : sWidth } margin-right
{ margin-top : sHeight } margin-top
{ padding : sPadding } padding
{ padding-bottom : sPadding } padding-bottom
{ padding-left : sPadding } padding-left
{ padding-right : sPadding } padding-right
{ padding-top : sPadding } padding-top
{ table-layout : sLayout } table-layout

CSS 3:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
{ border-break : sBreak } border-break
{ border-image : sImage } border-image
{ border-radius : sRadius } border-radius
{ box-shadow : sShadow } box-shadow

定位

CSS 2.1:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
{ bottom : sBottom } bottom 部分 部分 部分
{ clip : sClip } clip
{ display : sDisplay } display 部分 部分 部分 部分
{ height : sHeight } height
{ left : sPosition } left 部分 部分 部分
{ max-height : sMaxHeight } max-height ��
{ max-width : sWidth } max-width
{ min-height : sMinHeight } min-height
{ min-width : sMinWidth } min-width
{ overflow : sOverflow } overflow 部分 部分 部分
{ position : sPosition } position 部分 部分 部分
{ right : sPosition } right 部分 部分 部分
{ top : sTop } top 部分 部分 部分
{ visibility : sVisibility } visibility
{ width : sWidth } width
{ z-index : vOrder } z-index 部分 部分 部分 部分

CSS 3:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
{ overflow-x : sOverflow } overflow-x 部分 部分 部分
{ overflow-y : sOverflow } overflow-y 部分 部分 部分

打印

CSS 2.1:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
{ orphans : nLines } orphans
{ page-break-after : sBreak } page-break-after
{ page-break-before : sBreak } page-break-before
{ page-break-inside : sBreak } page-break-inside
{ widows : nLines } widows

CSS 3:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
{ fit : sFit } fit
{ fit-position : sPosition } fit-position
{ image-orientation : sOrientation } image-orientation
{ page : sPage } page
{ size : sSize } size

用戶界面

CSS 2.1:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
{ cursor : sCursor } cursor
{ outline : sOutline } outline
{ outline-color : sColor } outline-color
{ outline-style : sStyle } outline-style
{ outline-width : sWidth } outline-width

CSS 3:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
{ appearance : sAppearance } appearance
{ box-sizing : sSizing } box-sizing
{ icon : sIcon } icon
{ nav-down : sNavDown } nav-down
{ nav-index : sIndex } nav-index
{ nav-left : sNavLeft } nav-left
{ nav-right : sNavRight } nav-right
{ nav-up : sNavUp } nav-up
{ outline-offset : sOffset } outline-offset
{ outline-radius : sRadius } outline-radius
{ resize : sResize } resize

多列布局

CSS 3:

  Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
{ column-break-after : sSize } column-break-after
{ column-break-before : sSize } column-break-before
{ column-break-inside : sSize } column-break-inside
{ column-count : sCount } column-count
{ column-gap : sSize } column-gap
{ column-rule : sRule } column-rule
{ columns : sColumns } columns

語音

Internet Explorer 中不支持以下 CSS 3 語音屬性:

  • voice-volume
  • voice-balance
  • speak
  • pause
  • pause-after
  • pause-before
  • rest
  • rest-before
  • rest-after
  • cue
  • cue-after
  • cue-before
  • mark
  • mark-before
  • mark-after
  • voice-family
  • voice-rate
  • voice-pitch
  • voice-pitch-range
  • voice-stress
  • voice-duration
  • phonemes

媒體查詢

Internet Explorer 中不支持以下 CSS 3 媒體查詢屬性:

  • width
  • height
  • device-width
  • device-height
  • device-aspect-ratio
  • color
  • color-index
  • monochrome
  • resolution
  • scan
  • grid

數字

CSS 2.1:

 Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
<number>
<length>
<percentage>
<integer>

CSS 3:

 Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
<angle>
<time>
<frequency>

字符串

CSS 2.1:

 Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
<string>
/code

形狀

CSS 2.1:

 Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
rect()

函數

CSS 2.1:

 Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
url()
counter()
attr()

CSS 3:

 Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
calc()

顏色

CSS 2.1:

 Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
<color>(名稱)
<color>(#rrggbbor#rgb 表示法)
<color>(rgb(r,g,b) 表示法)
<color>(系統顏色)
透明 部分

CSS 3:

 Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
<color>(rgba(r,g,b,a) 表示法)
<color>(hsl(h,s,l) 表示法)
<color>(hsla(h,s,l,a) 表示法)

關鍵字

CSS 2.1:

 Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
auto 部分
inherit

CSS 3:

 Internet Explorer 5Internet Explorer 5.5Internet Explorer 6Internet Explorer 7Internet Explorer 8
initial

單位

Internet Explorer 3.0 和更高版本中支持以下所有單位:

  • px
  • pt
  • pc
  • cm
  • mm
  • in
  • em
  • ex
  • %

Internet Explorer 中不支持以下任何 CSS 3 單位:

  • deg
  • grad
  • rad
  • ms
  • s
  • Hz
  • kHz
  • turn
  • gd
  • rem
  • vw
  • vh
  • vm
  • ch

另請參閱

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章