HTML第10章:CSS格式化排版

10.1文字排版–字体

body{font-family:"Microsoft Yahei";}/*设置字体为微软雅黑*/

10.2文字排版–字号、颜色

可以使用下面代码设置网页中文字的字号为12像素,并把字体颜色设置为#666(灰色):

body{font-size:12px;color:#666}

10.3文字排版–粗体

可以使用下面代码实现设置文字以粗体样式显示出来

p span{font-weight:bold;}

10.4文字排版–斜体

p a{font-style:italic;}

10.5文字排版–下划线

p a{text-decoration:underline;}

10.6文字排版–删除线

.oldPrice{text-decoration:line-through;}

10.7段落排版–缩进

p{text-indent:2em;}

10.8段落排版–行间距(行高)

p{line-height:2em;}

10.9段落排版–中文字间距、字母间距

字母与字母之间的间距设置:

h1{
    letter-spacing:50px;
}

单词间距设置:

h1{
    word-spacing:50px;
}

10.10段落排版–对齐

h1{
    text-align:center/left/right;
}
<h1>了不起的盖茨比</h1>
发布了30 篇原创文章 · 获赞 36 · 访问量 706

猜你喜欢

转载自blog.csdn.net/qq_42745340/article/details/103449819