CSS 2.1 快速導覽 - 文字裝飾 text-decoration

text-decoration 性質 (property) 為 CSS 中用來設定文字的裝飾,有以下的關鍵字 (keyword)

  • none
  • underline
  • overline
  • line-through
  • blink


舉例如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
div {
    width: 500;
    height: 30;
}
 
.examplenone {
    text-decoration: none;
}
 
.exampleunderline {
    text-decoration: underline;
}
 
.exampleoverline {
    text-decoration: overline;
}
 
.examplelinethrough {
    text-decoration: line-through;
}
 
.exampleblink {
    text-decoration: blink;
}
 
/* 《程式語言教學誌》的範例程式
    檔名:text17.css
    功能:示範 CSS 2.1 樣式表的使用
    作者:張凱慶
    時間:西元 2011 年 7 月 */


我們以下面的 HTML 文件載入
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<html>
<head>
<title>網頁標題</title>
<link rel="stylesheet" type="text/css"
      href="text17.css">
</head>
<body>
<div class="examplenone">
Free your mind.
</div>
<div class="exampleunderline">
Free your mind.
</div>
<div class="exampleoverline">
Free your mind.
</div>
<div class="examplelinethrough">
Free your mind.
</div>
<div class="exampleblink">
Free your mind.
</div>
</body>
</html>
 
<!-- 《程式語言教學誌》的範例程式
     檔名:text17.html
     功能:示範 CSS 2.1 樣式表的使用
     作者:張凱慶
     時間:西元 2011 年 7 月 -->


瀏覽器 (broswer) 開啟如下



none 為沒有裝飾, underline 為底線, overline 為上標線,出現在文字上方,或稱為頂線, line-through 則是跨越文字中央的刪除線, blink 為閃爍效果。


中英文術語對照
性質property
關鍵字keyword
瀏覽器broswer


您可以繼續參考

JavaScript 範例

文字相關


相關目錄
CSS 2.1 快速導覽
HTML, CSS 教材
首頁


參考資料
http://www.w3.org/TR/CSS21/text.html
https://developer.mozilla.org/en/CSS/text-decoration

沒有留言: