CSS初級入門:文字的屬性

來源:互聯網
上載者:User

  文字屬性
  文字屬性是可以設定文字的顏色、大小、字型、粗細等等。
原始代碼
<STYLE>
SPAN.c1 {color:red;position:relative;font-size:12px;font-family:Arial;font-weight:700}
SPAN.c2 {color:blue}
SPAN.c3 {color:green}
SPAN.c4 {color:pink}
</STYLE>
<SPAN CLASS=c1>A</SPAN>
<SPAN CLASS=c2>B</SPAN>
<SPAN CLASS=c3>C</SPAN>
<SPAN CLASS=c4>D</SPAN>
顯示結果
A
B
C
D
  文字顏色 { COLOR }
  文法:{ COLOR : ( color ) }
原始代碼
<STYLE>
SPAN.test {color:red}
</STYLE>
<SPAN CLASS=test>A B C D</SPAN>
顯示結果
A B C D
  文字類別 { FONT }
  設定字型樣式、大小寫變化、粗細、大小、文字行列高度、字型
  文法:{ FONT : ( font-style )?( font-variant )?( font-weight )?( font-size )?( font-family )?/ ( line-height ) }
原始代碼
<STYLE>
SPAN.test {FONT:ITALIC BOLD 12pt/18pt}
</STYLE>
<SPAN CLASS=test>A B C D</SPAN>
顯示結果
A B C D
  下載字型 { @FONT-FACE }
  文法:@FONT-FACE { FONT-FAMILY : ( font-family ) ; SRC : URL ( url ) }
原始代碼
<STYLE>
@FONT-FACE { FONT-FAMILY : (未定) ; SRC : URL ( 下載地址 ) }
</STYLE>
顯示結果
沒有結果
  文字字型 { FONT-FAMILY }
  文法:{ FONT-FAMILY : ( font-name )?( generic-family ) }
原始代碼
<STYLE>
SPAN.test {FONT-FAMILY:"Arial Black"}
</STYLE>
<SPAN CLASS=test>A B C D</SPAN>
顯示結果
A B C D
  文字大小 { FONT-SIZE }
  設定字型大小 ( 可設單位屬性 : 點 pt、英寸 in、公分 cm、像素 px、百分比 % )
  文法:{ FONT-SIZE : LARGE?MEDIUM?SMALLER?( length )?( percentage ) }
原始代碼
<STYLE>
SPAN.test1 {FONT-SIZE:LARGE}
SPAN.test2 {FONT-SIZE:10pt}
SPAN.test3 {FONT-SIZE:50%}
</STYLE>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.