一, font-family
该属性用于指定文字的字体类型, 如宋体, 黑体, 隶书, 楷体, Times New Roman 等. 具体的语法如下:
{font-family:name;}
其中, name 是字体的名称. 如:{font-family: 宋体;}
二, font-size
该属性用来设置文字的大小. 具体的语法格式如下:
{font-size: 数值 | xx-small | x-small | small | medium | large | x-large
| xx-large | larger | smaller | lentgth | inherit;}
这些参数代表的意义分别是: 像素数值, 最小, 较小, 小, 正常, 大, 较大, 最大, 相对字体尺寸, 相对字体尺寸, 百分比, 继承.
三, font-style
推荐学习(CSS 手册 https://www.html.cn/book/css/ )
该属性是用来定义字体的风格, 即字体的显示样式. 具体的语法如下:
{font-style: normal | intalic | oblique | inherit;}
其中属性值分别表示默认值, 斜体, 倾斜, 继承.
四, font-weight
该属性用来定义字体的粗细程度, 具体的语法如下:
{font-weight: 100-900 | bold | bolder | lighter | normal;}
其中的属性值分别表示数值, 粗体, 更粗, 更细, 默认.
五, font-variant
该属性用于设置大写字母的字体显示. 具体的语法格式如下:
{font-variant: normal | small-caps | inherit;}
其中的参数值分别表示默认值, 显示小型大写字母的字体, 继承.
六, font
该属性可以一次性使用多个属性来定义文本字体, 是字体的复合属性. 具体语法如下:
{font: font-style | font-variant | font-weight | font-size | font-family;}
七, text-decoration
文本装饰属性用来让文本有更多的展现形式, 如: 上划线, 下划线, 中划线 (删除线) 等
- text-decoration: none;/* 取消装饰 */
- text-decoration: underline;/* 下划线 */
- text-decoration: overline;/* 上划线 */
- text-decoration: line-through;/* 删除线 */
八, text-indent
text-indent: 属性用来设置首行的文本缩进, 属性值有三种, 一个字符宽度的倍数 em, 相对于浏览器窗口宽度的百分比 %, 像素 px(p{text-indent: 2em;})
注意:
1em 就是一个字的宽度, 2em 就是两个字的宽度
text-indent: 2em;
九, color
color 属性用来设置字体的颜色, 字体颜色设置格式有三种
浏览器预设样色, 如 red,pink,blue,grenn 等 (p{color:pink;}) 十六进制格式, 如 #333,#eee,#ff3300 等 (p{color:#333;})RGB 颜色代码, 如红色可以表达为 rgb(255,0,0) 或者 rgb(100%,0%,0%)
十, line-height
line-height 用来设置行于行之间的距离, 属性值有三种单位, 像素 px, 百分比 %, 相对值 em(p{line-height: 15px;})
十一, text-align: 文本对齐方式
text-align 用来设置文本的对齐方式, 属性值有三种, 左对齐 left, 右对齐 right, 居中对齐 center(p{text-align: center;})
本文来自 CSS 答疑 https://www.html.cn/qa/css3/ 栏目, 欢迎学习!
来源: http://www.css88.com/qa/css3/14233.html