css - 字体属性与文本属性

字体属性

设置字体(font-family):

selected {
    font-family: Arial,"Microsoft Yahei";
}

Windows默认支持的字体:SimSun,"Microsoft Yahei",Arial,Tahoma,Verdana

设置字体的时候,先英后中,保证中英字体兼容到。

设置字体大小(font-size):

selected {
    font-size: 21px; (medium 默认值)
}

标题是特殊的,需要单独设置大小

设置文字的粗细(font-weight):

selected{
    font-weight: 100; normal(默认值)
}

粗体字体:bold,更粗的字体:bolder,细的字体:lighter

由粗到细:100 ~ 900

设置字体的类型(font-style):

selected {
    font-style: italic; normal(默认值)
}

italic:斜体,oblique:倾斜

设置字体的行高(line-height):

selected {
    line-height: 20px or 130% or 3; (normal 默认值)
}

px - 像素,130% - 百分比,3 - 当前字体大小*3

复合属性:

font:font-style  font-weight  font-size/line-height  font-family

 

文本属性

文本颜色(color):

selected {
    color: red or 二进制 or rgb(200,200,200);
}

文本对齐(text-align):

selected {
    text-align: left or right or center;
}

文本装饰(text-decoration):

selected {
    text-decoration: underline; (none 默认值)
}

 underline:下划线,overline:上划线,line-through:删除线

首行缩进(text-index):

selected {
    text-indent: 2em;
}

 

posted on 2022-03-10 22:36  每天积极向上  阅读(81)  评论(0编辑  收藏  举报

导航