字体格式
font-family
p {
font-family : "宋体";
}
字体大小
font-size
p {
font-size : 20px;
}
字体粗细
font-weight : normal | bold | bolder | lighter | number
正常 粗体 特粗 细体
tips: 不需要单位 px
p {
font-weight : 20;
}
字体样式
font-style : normal(正常) | italic (斜体)
文本颜色
color
文本对齐
text-align 可选值: left (默认)| right | center tips:本质上是让盒子里面的文字水平居中对齐 实际上盒子还是那么大
div {
text-align : center;
}
文本装饰 (上下划线)
text-decoration 可选 underline , overline ,line-through
div {
text-decoration : underline;
}
文本缩进
text-indent 可选 单位px (20px) ,em(2em) tips: em是一个相对单位 ,获取的是当前元素的font-size ,如果没有就拿父级的
div {
text-indent : 2em;
}
行间距(行高)
line-height 单位px
不会改动文本高度 ,只改动上下间距
div{
line-height : 20px ;
}