CSS3中选择器

作者:小橘猫 | 创建时间: 2023-07-22
css3中的属性选择器...
CSS3中选择器

操作方法

选择器: :root  根选择器(相当于html) :not  取反选中器(否定选择器) :empty  空选择器(选中没有任何元素的标签) :target  目的选择器

选择器:(同级元素标签,标签相同) :first-child    第一个子元素 :last-child    最后一个子元素 :nth-child(n) :only-child  只有一个子元素时 :nth-last-child(n) 倒数 n:数字 / 表达式 / 奇odd / 偶even

选择器:(同级元素标签,标签不同) :first-of-type   第一个子元素 :last-of-type    最后一个子元素 :nth-of-type(n) :only-of-type   只有一个子元素时:nth-last-of-type(n) 倒数 n:数字 / 表达式 / 奇odd / 偶even

选择器:(表单) :disabled  禁用 :enabled  可用 :checked  默认选中菜单

选择器: ::selection  默认选中 :read-only  只读 :read-write  可写

选择器:(举例div中class名) div [class= ' a' ]{ }     class名必须有a的 div [class*=' a ' ]{ }    class名中包含a的 div [class^=' a ' ]{ }    class名中以a开头 div [class$=' a ' ]{ }    class名中以a结尾

温馨提示

“+”: 同一级下一个 ; 空格:祖宗下所有的;>:下一级
点击展开全文

更多推荐