關於CSS3字型屬性整理分析

來源:互聯網
上載者:User
字型屬性:

Font-family: {font-family: name}

{font-family: cursive| fantasy | monospace | serif | sans-serif}

Font-size: {font-size: 數值 | inherit |xx-small | x-small | small | medium | large | x-large | xx-large | larger | smaller | length}

Font-style: {font-style: normal | italic | oblique | inherit}

Font-weight: {font-weight: 100-900 | bold | bolder | lighter | normal}

Font-variant: {font-variant: normal | small-caps | inherit}

字型複合屬性font: {font: font-style font-variant font-weight font-size font-family}

font-size和font-family必須在font屬性中出現,而且按固定順序。Font-style, font-variant, font-weight可以自由調換。

字型顏色color:{color: name | rgb | hex | hsl | hsla | rgba}

文本進階樣式

陰影文本text-shadow: {text-shadow: none | <length> none | [<shadow>,] * <opacity> 或none | <color> [, <color>]* }

Text-shadow有四個值,第一個值表示陰影的水平位移,可取正負值;第二個值表示陰影垂直位移,可取正負值;第三個值表示陰影的模糊半徑,該值可選;第四個值表示陰影顏色值,該值可選。

溢出文本text-overflow用來定義當文本溢出時是否顯示省略標記,即定義省略文本的溢出方式。而不具備其他的樣式屬性定義。要實現溢出時產生省略符號的效果還須定義:強制文本在一行內顯示(white-space:nowrap)及溢出內容為隱藏(over-flow:hidden)。 {text-overflow: clip | ellipsis}

Clip:不顯示省略標記(…),而是簡單的裁切條(主流瀏覽器都支援)

Ellipsis:當對象內文本溢出時顯示省略標記(…)(妹啊,Firefox竟然不支援)

控制換行word-wrap:{word-wrap: normal | break-word}

Normal: 控制連續文本換行

Break-word: 內容將在邊界內換行,如果需要詞內換行(word-break)也可以實現

保持字型尺寸不變font-size-adjust:{font-size-adjust: none | number}

None: 預設值,允許字型序列中每一字型遵守自己的尺寸

Number:為字型序列中所有字型強迫指定同一尺寸

段落屬性:

單詞間隔word-spacing: {word-spacing: normal | length}

字元間隔letter-spacing: {letter-spacing: normal | length}

文字修飾text-decoration: {text-decoration: none | underline | blink | overline |line-through}

垂直對齊vertical-align: {vertical: 屬性值}

水平對齊text-align: {text-align: sTextAlign}

文本轉換text-transform: {text-transform: none | capitalize |uppercase | lowercase}

文本縮排text-indent: {text-indent: length}

文本行高line-height: {line-height: normal | length}

處理空白white-space: {white-space: normal | pre | nowrap | pre-wrap | pre-line}

文本反排unicode-bidi和direction

Unicode-bidi: {Unicode-bidi: normal | bidi-override | embed}

Direction: {direction: ltr | rtl |inherit}

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.