字体样式
字体属性 | 作用 |
---|---|
font-size | 设置字体大小(最小12px) |
font-weight | 文字加粗(bold,100-900) |
font-family | 字体(宋体、楷体…) |
font-style | 文字风格(normal[正常]、italic[倾斜]) |
font | 同时包含以上四个属性(像这样的属性我们一般称作为复合属性) |
font设置的先后顺序
h1{
font: 字体风格 字体加粗 字体大小 字体;
/*
font属性必须有font-size font-family;其他可选
必须严格按照font-style font-weight font-size font-family顺序写
*/
}
文本属性样式
属性 | 含义 |
---|---|
color | 设置文本颜色 |
text-align | 设置元素的水平对齐方式 |
text-indent | 设置首行文本的缩进(一个文字缩进为16px) |
line-height | 设置文本的行高(每一行的高度) |
text-decoration | 设置文本的修饰(none值一般用于去掉a标签的下划线) |
hover伪类
作用:当光标移入元素时,该样式才生效
div{
width:500px;
height:500px;
background-color:gold;
/* 过渡 */
transition:10s;
}
/* 当光标移入时,div花10秒样式变成高100,宽100,颜色为红 */
div:hover{
width:100px;
height:100px;
background-color:red;
}