字体样式
属性名 |
含义 |
举例 |
font-family |
设置字体类型 |
font-family:"隶书"; |
font-size |
设置字体大小 |
font-size:12px; |
font-style |
设置字体风格 |
font-style:italic; |
font-weight |
设置字体的粗细 |
font-weight:bold; |
font |
在一个声明中设置所有字体属性 |
font:italic bold 36px "宋体"; |
文本样式
属性 |
含义 |
举例 |
color |
设置文本颜色 |
color:#00C; |
text-align |
设置元素水平对齐方式 |
text-align:right; |
text-indent |
设置首行文本的缩进 |
text-indent:20px; |
line-height |
设置文本的行高 |
line-height:25px; |
text-decoration |
设置文本的装饰 |
text-decoration:underline; |
使用CSS设置超链接
伪类名称 |
含义 |
示例 |
a:link |
未单击访问时超链接样式 |
a:link{color:#9ef5f9;} |
a:visited |
单击访问后超链接样式 |
a:visited {color:#333;} |
a:hover |
鼠标悬浮其上的超链接样式 |
a:hover{color:#ff7300;} |
a:active |
鼠标单击未释放的超链接样式 |
a:active {color:#999;} |
设置伪类的顺序:a:link->a:visited->a:hover->a:active
列表样式
list-style-type
list-style-image
值 |
说明 |
语法示例 |
none |
无标记符号 |
list-style-type:none; |
disc |
实心圆,默认类型 |
list-style-type:disc; |
circle |
空心圆 |
list-style-type:circle; |
square |
实心正方形 |
list-style-type:square; |
decimal |
数字 |
list-style-type:decimal |
线性渐变
linear-gradient ( position, color1, color2,…)