css3新增的伪类选择器(面试题)

列举css3中新增的选择器css选择器有哪些?css3新增的伪类有哪些?参考网址https://www.html.cn/book/css/selectors/pseudo-classes/only-child.htm

a:link没有访问之前a的样式;a:visited已访问a的样式;a:hover鼠标移上的样式;a:active鼠标按下的样式;input:focus获取光标

css3新增伪类选择器

:not 排除

:last-child 最后一个子元素

:nth-child(n) n表示具体的第n个 odd/2n+1奇数 even/2n偶数

only-child 仅仅/唯一只有一个

nth-last-child倒数第n个元素

:first-of-type第一个同级兄弟元素

:last-of-type最后一个同级兄弟元素

:only-of-type只有一个同级兄弟元素

:nth-of-type(n)第n个同级兄弟元素

:nth-last-of-type(n)倒数第几个同级兄弟元素

:empty空内容

 1 <style type="text/css">
 2 ul>li{
 3 float:left;
 4 list-style: none;
 5 width:100px;
 6 height: 50px;
 7 background: red;
 8 }
 9 ul li:not(:last-child){
10 /*除了最后一个没有右边框线,其余的都有*/
11 border-right:10px solid #000;
12 }
13 </style>
原文地址:https://www.cnblogs.com/webaction/p/13630243.html