1.color文本颜色三种表示
英语单词
但是范围太小了,工作中用得不多
例子:
color: red;
单词:
red红,blue蓝,green绿,yellow黄,pink粉…
rgb方式设置
比例的范围: 0-255
例子:
color: rgb(255,0,0);
color: rgb(100%,0%,0%); 都要是百分号才行,否则不行
十六进制表示
在十六进制中,每两位数代表一个原色
前面两个是红色,中间两个是绿色,后面两个是蓝色
例子:
color: #ff0000;
color: #f00; 这种也可以
2.text-align 水平对齐
控制文本的水平对齐属性: left center right
例子:
text-align: center;
3.line-height 行间距
行高,控制文本在垂直方向的位置
如果想让文字垂直居中
让文字的行高等于容器的高度即可
例子:
line-height: 100px;
快速写法:
lh100px
4.text-indent首行缩进(了解)
控制文本首行缩进
例子:
text-indent:20px;
text-indent: 2em;
5.text-decoration文本的修饰属性
通常我们用于给链接修改装饰效果
例子:
text-decoration: underline; 下划线
text-decoration: overline; 上划线
text-decoration: line-through; 删除线
最重要:
text-decoration: none; 没有线 将a标签自带的下划线清除