Home [CSS] CSS字體属性介绍
Post
Cancel

[CSS] CSS字體属性介绍

CSS字體属性介绍

CSS當中的屬性非常多,大致上可以分為以下幾類:字體、背景、文本、位置、佈局、邊緣、列表。

字體

  • Font-family設置字體系列
  • Font-size設定字體的大小
  • Font-style設定字體是否為斜體字(italic 或oblique)。
  • text-decoration
  • font-weight 屬性是用來設定字體的厚度。
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
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <style type="text/css">
        #p1 { /*id選擇器*/
            font-family:DFKai-SB;
        }
        #p2{
            font-size:xx-small;
        }
        .p3 { /*class選擇器/類選擇器*/
            font-style: italic;
            border-top: dashed;
            border-left: dotted;
            border-bottom: double;
        }
        .p4 {
            font-weight:bolder;
        }
    </style>
</head>
<body>
    <p id="p1">Hello,你好嗎?今天天氣真好呀!</p>
    <p id="p2">Hello,你好嗎?今天天氣真好呀!</p>
    <p class="p3">Hello,你好嗎?今天天氣真好呀!</p>
    <p class="p4">Hello,你好嗎?今天天氣真好呀!</p>
</body>
</html>
This post is licensed under CC BY 4.0 by the author.