您的当前位置:首页正文

css文字样式中属性的介绍(附代码)

2020-11-27 来源:我们爱旅游

本篇文章给大家带来的内容是关于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;}

相关推荐:

css设置文字属性的示例

CSS属性之字体(Font)_html/css_WEB-ITnose

网页CSS样式属性:font字体常识_html/css_WEB-ITnose