-
css背景
1)background-color:背景色(transparent、color)
2)background-image:背景图(none、url)
3)backgournd-repeat:设置背景图的铺排方式(repeat、no-repeat、repeat-x、repeat-y)
4)background-position:设置背景图位置({x-number|top|center|bottom} {y-number|left|center|right}),控制背景图片在元素的位置。x轴、y轴。如果只带一个参数,代表纵向为50%。
5)backgroud-attachment:背景图像滚动方式(scorll|fixed)
6)background:设置背景图复合写法。background:color image repeat attachment position body { background:#999 url(images/bg.jgp) repeat-x scroll 200px 100px } -
css伪类选择器
专门用来表示元素的一种特殊状态
1)a标签的伪类
a:link 未访问状态;a:visited已访问状态;a:hover鼠标悬停状态;a:active用户激活状态
2):focus获得焦点
input:focus {background-color:yellow;}
3):first-child选择元素的第一子\元素 :last-child | :nth-child(1number) | nth-of-type(number)
p:first-child {font-weight:bold}p:nth-child(2) 筛选出所有子元素 选择第二个判断是否为p元素 是就把字体设置为#ff0000.
而p:nth-of-type(2) 先筛选出子元素中的p元素,再选择第二个p元素并把字体设为#55b7dd.