您的位置:首页 > Web前端 > CSS

CSS中的字体属性和文本属性

2017-08-07 00:00 337 查看
##1.CSS字体的属性

font                    简写,作用是把所有的针对字体的属性设置在一个声明中
font-family             设置字体系列
font-size               设置字体尺寸
font-style              设置字体风格,italic或者normal;
font-variant            以小型大写字体或者正常字体显示文本
font-weight             设置字体的粗细,normal/bold/bolder/lighter

实例:在一个声明上设置所有的字体属性:

font:italic bold 12px;//设置字体大小
font-size:200%;

##2.CSS的文本属性:

color                   设置文本颜色
direction               设置文本方向
line-height             设置行高
letter-spacing          设置字符间距
text-align              对齐元素中的文本
text-decoration         向文本中添加修饰
text-indent             缩进元素中文本的首行
text-transform          控制元素中的字母
unicode-bldl            设置文本的方向
white-space             设置元素中空白的处理方式
word-spacing            设置字间距

实例:

<p style="color:red;
line-height:40px;
letter-spacing:10px;
background-color:silver;
width:300px;
height:300px;
text-align:center;">hello world<br>hello world<br>
</p>

效果:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  HTML CSS