CSS3中選擇器
- 互聯網
- 關注:5.51K次
css3中的屬性選擇器
操作方法
(01)選擇器::root 根選擇器(相當於html):not 取反選中器(否定選擇器):empty 空選擇器(選中沒有任何元素的標籤):target 目的選擇器
(02)選擇器:(同級元素標籤,標籤相同):first-child 第一個子元素:last-child 最後一個子元素:nth-child(n):only-child 只有一個子元素時:nth-last-child(n) 倒數n:數字 / 表達式 / 奇odd / 偶even
(03)選擇器:(同級元素標籤,標籤不同):first-of-type 第一個子元素:last-of-type 最後一個子元素:nth-of-type(n):only-of-type 只有一個子元素時:nth-last-of-type(n) 倒數n:數字 / 表達式 / 奇odd / 偶even
(04)選擇器:(表單):disabled 禁用:enabled 可用:checked 默認選中菜單
(05)選擇器:::selection 默認選中:read-only 只讀:read-write 可寫
(06)選擇器:(舉例div中class名)div [class= ' a' ]{ } class名必須有a的div [class*=' a ' ]{ } class名中包含a的div [class^=' a ' ]{ } class名中以a開頭div [class$=' a ' ]{ } class名中以a結尾
特別提示
“+”: 同一級下一個 ; 空格:祖宗下所有的;>:下一級
- 文章版權屬於文章作者所有,轉載請註明 https://miaozhigu.com/sm/hulianwang/de09zk.html