CSS选择符、优先级算法以及内联和important哪个优先级高?

您所在的位置:网站首页 css选择符类型为 CSS选择符、优先级算法以及内联和important哪个优先级高?

CSS选择符、优先级算法以及内联和important哪个优先级高?

2023-08-13 20:48| 来源: 网络整理| 查看: 265

css选择符类型:

1、通用选择器:* 2、类别选择器:.class 3、id选择器:#id 4、标签选择器:p 5、后代选择器:div p 6、子选择器:div > p 7、群组选择器:div , p 8、相邻同胞选择器:div +p 9、伪类选择器::link :visited :active :hover :focus :first-child 10、伪元素选择器::first-letter :first-line:before :after :lang(language) 11、属性选择器:[attribute] [attribute=value] [attribute~=value] [attribute|=value]

css3新增的伪类选择器:

:first-of-type :last-of-type :only-of-type :only-child :nth-child(n) :nth-last-of-type(n) :last-child :root :empty :target :enabled :disabled :checked :not(selector)

CSS哪些属性可以继承? css继承特性主要是指文本方面的继承,盒模型相关的属性基本没有继承特性。 所有元素可继承: visibility和cursor 块级元素可继承 text-indent和text-align 内联元素可继承的: letter-spacing、word-spacing、white-space、line-height、color、font、font-family、font-size、font-style、font-variant、font-weight、text-decoration、text-transform、direction

优先级为!important > [ id > class > tag ]

!Important 比 内联优先级高



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3