Style對(duì)象表示單個(gè)樣式聲明。
可以從文檔或從應(yīng)用該樣式的元素訪問(wèn)Style對(duì)象。
下表列出了Style對(duì)象的屬性。
“ CSS”列指示該屬性在哪個(gè)CSS版本中定義(CSS1,CSS2或CSS3)。
| 屬性 | 描述 | CSS |
|---|---|---|
| alignContent | 當(dāng)項(xiàng)目不使用所有可用空間時(shí),設(shè)置或返回彈性容器內(nèi)各行之間的對(duì)齊方式 | 3 |
| alignItems | 設(shè)置或返回彈性容器內(nèi)項(xiàng)目的對(duì)齊方式 | 3 |
| alignSelf | 設(shè)置或返回彈性容器內(nèi)選定項(xiàng)目的對(duì)齊方式 | 3 |
| animation | 以下所有動(dòng)畫屬性的速記屬性,animationPlayState屬性除外 | 3 |
| animationDelay | 設(shè)置或返回動(dòng)畫開(kāi)始的時(shí)間 | 3 |
| animationDirection | 設(shè)置或返回動(dòng)畫是否應(yīng)交替播放一次 | 3 |
| animationDuration | 設(shè)置或返回動(dòng)畫完成一個(gè)周期需要多少秒或毫秒 | 3 |
| animationFillMode | 設(shè)置或返回動(dòng)畫在執(zhí)行時(shí)間之外應(yīng)用的值 | 3 |
| animationIterationCount | 設(shè)置或返回動(dòng)畫播放的次數(shù) | 3 |
| animationName | 設(shè)置或返回@keyframes動(dòng)畫的名稱 | 3 |
| animationTimingFunction | 設(shè)置或返回動(dòng)畫的速度曲線 | 3 |
| animationPlayState | 設(shè)置或返回動(dòng)畫是運(yùn)行還是暫停 | 3 |
| background | 在一個(gè)聲明中設(shè)置或返回所有背景屬性 | 1 |
| backgroundAttachment | 設(shè)置或返回背景圖像是固定的還是與頁(yè)面一起滾動(dòng) | 1 |
| backgroundColor | 設(shè)置或返回元素的背景色 | 1 |
| backgroundImage | 設(shè)置或返回元素的背景圖像 | 1 |
| backgroundPosition | 設(shè)置或返回背景圖像的起始位置 | 1 |
| backgroundRepeat | 設(shè)置或返回如何重復(fù)(平鋪)背景圖像 | 1 |
| backgroundClip | 設(shè)置或返回背景的繪畫區(qū)域 | 3 |
| backgroundOrigin | 設(shè)置或返回背景圖像的定位區(qū)域 | 3 |
| backgroundSize | 設(shè)置或返回背景圖像的大小 | 3 |
| backfaceVisibility | 設(shè)置或返回當(dāng)不面對(duì)屏幕時(shí)元素是否應(yīng)該可見(jiàn) | 3 |
| border | 在一個(gè)聲明中設(shè)置或返回borderWidth,borderStyle和borderColor | 1 |
| borderBottom | 在一個(gè)聲明中設(shè)置或返回所有borderBottom屬性 | 1 |
| borderBottomColor | 設(shè)置或返回底部邊框的顏色 | 1 |
| borderBottomLeftRadius | 設(shè)置或返回左下角的邊框形狀 | 3 |
| borderBottomRightRadius | 設(shè)置或返回右下角邊框的形狀 | 3 |
| borderBottomStyle | 設(shè)置或返回底部邊框的樣式 | 1 |
| borderBottomWidth | 設(shè)置或返回底部邊框的寬度 | 1個(gè) |
| borderCollapse | 設(shè)置或返回是否將表格邊框折疊為單個(gè)邊框 | 2 |
| borderColor | 設(shè)置或返回元素邊框的顏色(最多可以有四個(gè)值) | 1 |
| borderImage | 用于設(shè)置或返回所有borderImage屬性的簡(jiǎn)寫屬性 | 3 |
| borderImageOutset | 設(shè)置或返回邊框圖像區(qū)域超出邊框的數(shù)量 | 3 |
| borderImageRepeat | 設(shè)置或返回是否應(yīng)重復(fù),四舍五入或拉伸圖像邊界 | 3 |
| borderImageSlice | 設(shè)置或返回圖像邊界的向內(nèi)偏移 | 3 |
| borderImageSource | 設(shè)置或返回用作邊框的圖像 | 3 |
| borderImageWidth | 設(shè)置或返回圖像邊框的寬度 | 3 |
| borderLeft | 在一個(gè)聲明中設(shè)置或返回所有borderLeft屬性 | 1 |
| borderLeftColor | 設(shè)置或返回左邊框的顏色 | 1 |
| borderLeftStyle | 設(shè)置或返回左邊框的樣式 | 1 |
| borderLeftWidth | 設(shè)置或返回左邊框的寬度 | 1個(gè) |
| borderRadius | 用于設(shè)置或返回所有四個(gè)borderRadius屬性的簡(jiǎn)寫屬性 | 3 |
| borderRight | 在一個(gè)聲明中設(shè)置或返回所有borderRight屬性 | 1 |
| borderRightColor | 設(shè)置或返回右邊框的顏色 | 1 |
| borderRightStyle | 設(shè)置或返回右邊框的樣式 | 1 |
| borderRightWidth | 設(shè)置或返回右邊框的寬度 | 1 |
| borderSpacing | 設(shè)置或返回表格中單元格之間的空間 | 2 |
| borderStyle | 設(shè)置或返回元素邊框的樣式(最多可以有四個(gè)值) | 1 |
| borderTop | 在一個(gè)聲明中設(shè)置或返回所有borderTop屬性 | 1 |
| borderTopColor | 設(shè)置或返回頂部邊框的顏色 | 1 |
| borderTopLeftRadius | 設(shè)置或返回左上角的邊框形狀 | 3 |
| borderTopRightRadius | 設(shè)置或返回右上角邊框的形狀 | 3 |
| borderTopStyle | 設(shè)置或返回頂部邊框的樣式 | 1 |
| borderTopWidth | 設(shè)置或返回頂部邊框的寬度 | 1 |
| borderWidth | 設(shè)置或返回元素邊框的寬度(最多可以有四個(gè)值) | 1 |
| bottom | 設(shè)置或返回定位元素的底部位置 | 2 |
| boxDecorationBreak | 設(shè)置或返回元素在分頁(yè)符處或行內(nèi)元素在換行符處的背景和邊框的行為。 | 3 |
| boxShadow | 將一個(gè)或多個(gè)陰影附加到框 | 3 |
| boxSizing | 允許您定義某些元素以某種方式適合某個(gè)區(qū)域 | 3 |
| captionSide | 設(shè)置或返回表格標(biāo)題的位置 | 2 |
| clear | 設(shè)置或返回元素相對(duì)于浮動(dòng)對(duì)象的位置 | 1 |
| clip | 設(shè)置或返回定位元素的哪一部分可見(jiàn) | 2 |
| color | 設(shè)置或返回文本的顏色 | 1 |
| columnCount | 設(shè)置或返回元素應(yīng)劃分為的列數(shù) | 3 |
| columnFill | 設(shè)置或返回如何填充列 | 3 |
| columnGap | 設(shè)置或返回列之間的間隙 | 3 |
| columnRule | 用于設(shè)置或返回所有columnRule屬性的簡(jiǎn)寫屬性 | 3 |
| columnRuleColor | 設(shè)置或返回列之間規(guī)則的顏色 | 3 |
| columnRuleStyle | 設(shè)置或返回列之間的規(guī)則樣式 | 3 |
| columnRuleWidth | 設(shè)置或返回列之間的規(guī)則寬度 | 3 |
| columns | 用于設(shè)置或返回columnWidth和columnCount的簡(jiǎn)寫屬性 | 3 |
| columnSpan | 設(shè)置或返回元素應(yīng)跨越多少列 | 3 |
| columnWidth | 設(shè)置或返回列的寬度 | 3 |
| content | 與:before和:after偽元素一起使用,以插入生成的內(nèi)容 | 2 |
| counterIncrement | 增加一個(gè)或多個(gè)計(jì)數(shù)器 | 2 |
| counterReset | 創(chuàng)建或重置一個(gè)或多個(gè)計(jì)數(shù)器 | 2 |
| cursor | 設(shè)置或返回要顯示給鼠標(biāo)指針的光標(biāo)的類型 | 2 |
| direction | 設(shè)置或返回文本方向 | 2 |
| display | 設(shè)置或返回元素的顯示類型 | 1 |
| emptyCells | 設(shè)置或返回是否顯示空白單元格的邊框和背景 | 2 |
| filter | 設(shè)置或返回圖像濾鏡(視覺(jué)效果,如模糊和飽和度) | 3 |
| flex | 設(shè)置或返回項(xiàng)目相對(duì)于其余部分的長(zhǎng)度 | 3 |
| flexBasis | 設(shè)置或返回彈性物料的初始長(zhǎng)度 | 3 |
| flexDirection | 設(shè)置或返回彈性項(xiàng)目的方向 | 3 |
| flexFlow | flexDirection和flexWrap屬性的簡(jiǎn)寫屬性 | 3 |
| flexGrow | 設(shè)置或返回項(xiàng)目相對(duì)于其余項(xiàng)目的增長(zhǎng)量 | 3 |
| flexShrink | 設(shè)置或返回項(xiàng)目相對(duì)于其余項(xiàng)目的收縮方式 | 3 |
| flexWrap | 設(shè)置或返回彈性項(xiàng)目是否應(yīng)該包裝 | 3 |
| cssFloat | 設(shè)置或返回元素的水平對(duì)齊方式 | 1 |
| font | 在一個(gè)聲明中設(shè)置或返回fontStyle,fontVariant,fontWeight,fontSize,lineHeight和fontFamily | 1 |
| fontFamily | 設(shè)置或返回文本的字體系列 | 1 |
| fontSize | 設(shè)置或返回文本的字體大小 | 1 |
| fontStyle | 設(shè)置或返回字體的樣式是普通,斜體還是斜體 | 1 |
| fontVariant | 設(shè)置或返回是否以小寫大寫字母顯示字體 | 1 |
| fontWeight | 設(shè)置或返回字體的粗體 | 1 |
| fontSizeAdjust | 發(fā)生字體回退時(shí)保留文本的可讀性 | 3 |
| fontStretch | 從字體系列中選擇一個(gè)普通的,壓縮的或擴(kuò)展的字體 | 3 |
| hangingPunctuation | 指定是否可以在行框外放置標(biāo)點(diǎn)符號(hào) | 3 |
| height | 設(shè)置或返回元素的高度 | 1 |
| hyphens | 設(shè)置如何拆分單詞以改善段落的布局 | 3 |
| icon | 使作者能夠使用標(biāo)志性的等效樣式設(shè)置元素的樣式 | 3 |
| imageOrientation | 指定用戶代理應(yīng)用于圖像的向右或順時(shí)針?lè)较虻男D(zhuǎn) | 3 |
| isolation | 定義元素是否必須創(chuàng)建新的堆疊內(nèi)容 | 3 |
| justifyContent | 當(dāng)項(xiàng)目未使用所有可用空間時(shí),設(shè)置或返回項(xiàng)目在彈性容器內(nèi)的對(duì)齊方式。 | 3 |
| left | 設(shè)置或返回定位元素的左側(cè)位置 | 2 |
| letterSpacing | 設(shè)置或返回文本中字符之間的空格 | 1 |
| lineHeight | 設(shè)置或返回文本中行之間的距離 | 1 |
| listStyle | 在一個(gè)聲明中設(shè)置或返回listStyleImage,listStylePosition和listStyleType | 1 |
| listStyleImage | 設(shè)置或返回圖像作為列表項(xiàng)標(biāo)記 | 1 |
| listStylePosition | 設(shè)置或返回列表項(xiàng)標(biāo)記的位置 | 1 |
| listStyleType | 設(shè)置或返回列表項(xiàng)標(biāo)記類型 | 1 |
| margin | 設(shè)置或返回元素的邊距(最多可以有四個(gè)值) | 1 |
| marginBottom | 設(shè)置或返回元素的底邊距 | 1 |
| marginLeft | 設(shè)置或返回元素的左邊距 | 1 |
| marginRight | 設(shè)置或返回元素的右邊距 | 1 |
| marginTop | 設(shè)置或返回元素的上邊距 | 1 |
| maxHeight | 設(shè)置或返回元素的最大高度 | 2 |
| maxWidth | 設(shè)置或返回元素的最大寬度 | 2 |
| minHeight | 設(shè)置或返回元素的最小高度 | 2 |
| minWidth | 設(shè)置或返回元素的最小寬度 | 2 |
| navDown | 設(shè)置或返回使用向下導(dǎo)航鍵時(shí)的導(dǎo)航位置 | 3 |
| navIndex | 設(shè)置或返回元素的制表順序 | 3 |
| navLeft | 設(shè)置或返回使用左箭頭導(dǎo)航鍵時(shí)導(dǎo)航到的位置 | 3 |
| navRight | 設(shè)置或返回使用向右導(dǎo)航鍵時(shí)的導(dǎo)航位置 | 3 |
| navUp | 設(shè)置或返回使用向上箭頭導(dǎo)航鍵時(shí)的導(dǎo)航位置 | 3 |
| objectFit | 指定替換元素的內(nèi)容應(yīng)如何適合其使用的高度和寬度建立的框 | 3 |
| objectPosition | 指定替換元素在其框內(nèi)的對(duì)齊方式 | 3 |
| opacity | 設(shè)置或返回元素的不透明度級(jí)別 | 3 |
| order | 設(shè)置或返回彈性項(xiàng)目相對(duì)于其余項(xiàng)目的順序 | 3 |
| orphans | 設(shè)置或返回元素內(nèi)發(fā)生分頁(yè)符時(shí)必須保留在頁(yè)面底部的元素的最小行數(shù) | 2 |
| outline | 在一個(gè)聲明中設(shè)置或返回所有輪廓屬性 | 2 |
| outlineColor | 設(shè)置或返回元素周圍輪廓的顏色 | 2 |
| outlineOffset | 偏移輪廓,并將其繪制到邊框邊緣之外 | 3 |
| outlineStyle | 設(shè)置或返回元素周圍輪廓的樣式 | 2 |
| outlineWidth | 設(shè)置或返回元素周圍輪廓的寬度 | 2 |
| overflow | 設(shè)置或返回在元素框外呈現(xiàn)的內(nèi)容的處理方式 | 2 |
| overflowX | 指定在內(nèi)容的左/右邊緣溢出元素的內(nèi)容區(qū)域時(shí)該如何處理 | 3 |
| overflowY | 指定在內(nèi)容的頂部/底部邊緣溢出元素的內(nèi)容區(qū)域時(shí)該如何處理 | 3 |
| padding | 設(shè)置或返回元素的填充(最多可以包含四個(gè)值) | 1 |
| paddingBottom | 設(shè)置或返回元素的底部填充 | 1 |
| paddingLeft | 設(shè)置或返回元素的左填充 | 1 |
| paddingRight | 設(shè)置或返回元素的右填充 | 1 |
| paddingTop | 設(shè)置或返回元素的頂部填充 | 1 |
| pageBreakAfter | 設(shè)置或返回元素后的分頁(yè)符行為 | 2 |
| pageBreakBefore | 設(shè)置或返回元素前的分頁(yè)符行為 | 2 |
| pageBreakInside | 設(shè)置或返回元素內(nèi)的分頁(yè)符行為 | 2 |
| perspective | 設(shè)置或返回有關(guān)如何查看3D元素的透視圖 | 3 |
| perspectiveOrigin | 設(shè)置或返回3D元素的底部位置 | 3 |
| position | 設(shè)置或返回用于元素的定位方法的類型(靜態(tài),相對(duì),絕對(duì)或固定) | 2 |
| quotes | 設(shè)置或返回嵌入引號(hào)的引號(hào)類型 | 2 |
| resize | 設(shè)置或返回元素是否可由用戶調(diào)整大小 | 3 |
| right | 設(shè)置或返回定位元素的正確位置 | 2 |
| tableLayout | 設(shè)置或返回布置表格單元格,行和列的方式 | 2 |
| tabSize | 設(shè)置或返回制表符的長(zhǎng)度 | 3 |
| textAlign | 設(shè)置或返回文本的水平對(duì)齊方式 | 1 |
| textAlignLast | 設(shè)置或返回文本對(duì)齊方式為“ justify”時(shí),塊或最后一行在強(qiáng)制換行之前的對(duì)齊方式 | 3 |
| textDecoration | 設(shè)置或返回文本的修飾 | 1 |
| textDecorationColor | 設(shè)置或返回文本裝飾的顏色 | 3 |
| textDecorationLine | 設(shè)置或返回文本裝飾中的行類型 | 3 |
| textDecorationStyle | 設(shè)置或返回文本修飾中線條的樣式 | 3 |
| textIndent | 設(shè)置或返回文本第一行的縮進(jìn) | 1 |
| textJustify | 設(shè)置或返回當(dāng)文本對(duì)齊為“ justify”時(shí)使用的對(duì)齊方法 | 3 |
| textOverflow | 設(shè)置或返回當(dāng)文本溢出包含元素時(shí)應(yīng)該發(fā)生的情況 | 3 |
| textShadow | 設(shè)置或返回文本的陰影效果 | 3 |
| textTransform | 設(shè)置或返回文本的大寫 | 1 |
| top | 設(shè)置或返回定位元素的頂部位置 | 2 |
| transform | 將2D或3D變換應(yīng)用于元素 | 3 |
| transformOrigin | 設(shè)置或返回轉(zhuǎn)換后元素的位置 | 3 |
| transformStyle | 設(shè)置或返回在3D空間中渲染嵌套元素的方式 | 3 |
| transition | 用于設(shè)置或返回四個(gè)過(guò)渡屬性的簡(jiǎn)寫屬性 | 3 |
| transitionProperty | 設(shè)置或返回過(guò)渡效果所針對(duì)的CSS屬性 | 3 |
| transitionDuration | 設(shè)置或返回轉(zhuǎn)換效果完成所需的秒數(shù)或毫秒數(shù) | 3 |
| transitionTimingFunction | 設(shè)置或返回過(guò)渡效果的速度曲線 | 3 |
| transitionDelay | 設(shè)置或返回過(guò)渡效果開(kāi)始的時(shí)間 | 3 |
| unicodeBidi | 設(shè)置或返回是否應(yīng)重寫文本以支持同一文檔中的多種語(yǔ)言 | 2 |
| userSelect | 設(shè)置或返回是否可以選擇元素的文本 | 2 |
| verticalAlign | 設(shè)置或返回元素中內(nèi)容的垂直對(duì)齊方式 | 1 |
| visibility | 設(shè)置或返回元素是否應(yīng)該可見(jiàn) | 2 |
| whiteSpace | 設(shè)置或返回如何處理文本中的制表符,換行符和空格 | 1 |
| width | 設(shè)置或返回元素的寬度 | 1 |
| wordBreak | 設(shè)置或返回非CJK腳本的換行規(guī)則 | 3 |
| wordSpacing | 設(shè)置或返回文本中單詞之間的間距 | 1 |
| wordWrap | 允許將長(zhǎng)而堅(jiān)不可摧的單詞打斷并換行到下一行 | 3 |
| widows | 設(shè)置或返回必須在頁(yè)面頂部可見(jiàn)的元素的最小行數(shù) | 2 |
| zIndex | 設(shè)置或返回定位元素的堆疊順序 | 2 |
HTML教程:HTML CSS
CSS教程:CSS教程
HTML參考:HTML <style>標(biāo)記
CSS參考:CSS屬性