font-family 选择字体样式,使字体看起来比较美观:
<style type="text/css">
.family{font-family: "Microsoft Yahei"}
</style>
与普通文字对比,可以看出有细微差别,还有许多字体的样式,不过想别人看到字体样式必须别人的电脑上也安装了相对应的字体样式,想看看有多少个样式可以查查万能的百度
font-weight 字体加粗
<style type="text/css">
.weight{font-weight: bold;}
</style>
其他参数有normal,正常粗细,lighter更细,bolder更粗
font-size 字体大小
<style type="text/css">
.size{font-size: 30px;}
</style>
font-size后面加像素px,具体自行测试大小
font-style 字体风格
<style type="text/css">
.normal {font-style:normal;}
.italic {font-style:italic;}
.oblique {font-style:oblique;}
</style>
text-decoration 字体装饰
<style type="text/css">
.underline{text-decoration:underline;}
.through{text-decoration: line-through;}
</style>
还有其他的文字装饰,可以到网上查查
text-indent段落缩进
<style type="text/css">
.indent{text-indent: 2em;}
</style>
一个em等于一个字体大小,2em代表缩进两个字体·
letter-spancing 字母间隔 word-spacing 单词间隔
<style type="text/css">
.letter{letter-spacing: 10px;}
.word{word-spacing: 10px;}
</style>
line-height 行高
<style type="text/css">
.height{line-height: 2em;}
</style>
2em表示两个字体的距离,行高是从上一行字体开始算的,第一行算1em,第二行空行算1em,如果填0em的话所有的字体会叠加在一起。
text-align对块状的文本图片的位置放置
text-align:center 水平居中
text-align:left 水平居左
text-align:right 水平居右