8.8
字体样式
字体大小:font-size: 30px;
字体加粗:font-weight: bolder;
字体加细:font-weight: lighter;
斜体:font-style: italic
字体颜色:color: red;
文本样式
设置文本线
下划线:text-decoration: underline;
顶划线:text-decoration: overline;
删除线:text-decoration: line-through;
取消下划线:text-decoration: none(超链接下划线取消);
大写:text-transform: uppercase;
小写:text-transform: lowercase;
段落首行缩进:text-indent: 2em;(可以用像素px,可以用em,1个em为一个字符)
文本对齐方式:text-align: center;;(文本居中 right靠右)
行高:line-height: 50px;
边框样式
设置背景色:
设置背景图:
background-image:url(img/a.jpg);
显示方式:
横向平铺:repeat-x;
纵向平铺:repeat-y;
横向纵向平铺:repert;
不平铺:no-repeat;
是否随内容滚动:fixed;
超链接未访问时的样式:
#a1:link{
text-decoration:none;
color:red;}
超链接访问过后的样式:
#a1:visited{
color:pink;}
当鼠标放在超链接上时的样子:
#a1:hover{
color:pink;}
当点击超链接时的样子:
#a1:active{
color:pink;}
变小手:
cursor:pointer;
定义这4个伪类,必须按照(link、visited、hover、active)LVHA的顺序进行,不然浏览器可能无法正常显示这4种样式。