伪类有::first-child ,:link:,vistited,:hover,:active,:focus,:lang
伪元素有::first-line,:first-letter,:before,:after
css清除浮动方法: (讲解)(hasLayout)
<style type="text/css">.clearfix:after{content:"\0020";display:block;height:0;clear:both;} .clearfix{zoom:1;} </style> <div class="clearfix"> <div style="float:left;width:45%;">清除浮动例子</div> <div style="float:right;width:45%;">清除浮动例子1111</div> </div>
<li>列表的奇数行和偶数行变色、<table>的行变色。
参考阅读:http://jingyan.baidu.com/article/aa6a2c14cea0120d4c19c4ec.html
li:nth-child(even){background:#dddddd;}/*偶数行*/ li:nth-child(odd){background:#f0f0f0;}/*奇数行*/ li:nth-child(2){background:#ff9900;}/*第二行*/ li:nth-child(3n+1){background:#cccccc;}/*第1、4、7…行*/ tr:nth-child(2){background:#ff99ff;}/*表格的第二行*/ tr :nth-child(2){background:#ff9900;}/*表格的第二列*/
时间: 2024-10-13 06:59:03