03:CSS设置文字样式

1.设置文字字体——font-family
属性值建议用英文黑体Arial;
微软雅黑 “Microsoft Yahei”;
宋体“SimSun”提高加载速度;
设置可选字体用逗号隔开)

index.html

<!doctype html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>字体</title>
    <link href="index.css" type="text/css" rel="stylesheet"/>
</head>
<body>
    <p>
    设置文字字体属性值建议用英文黑体Arial; 微软雅黑 “Microsoft Yahei”;
    宋体“SimSun”;提高加载速度;设置可选字体用逗号隔开
  </p> 
</body>
</html>

index.css

p{
    font-family:"SimSun";
}

2.设置文字大小——font-size
index.css

p{
    font-size:21px;
}

3.设置文字为粗体——font-weight
属性值:normal;正常
bold/bolder;加粗
index.css

p{
    font-weight:bold;
}

4.设置文字为斜体——font-style
属性值:italic;
index.css

p{
    font-style:italic;
}

5.设置英文为小型的大写字母字体
index.css

p{
font-variant: small-caps;
}

6.设置文字颜色
index.css

p{
    color:lightgreen;
}

7.设置文字背景颜色
index.css

p{
    background-color:lightblue;
}

                                                                                                20:29 2018/8/12/周日

猜你喜欢

转载自blog.csdn.net/fighting_0808/article/details/81610158
今日推荐