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>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM