
asIDe h4 { color:yellow;}article h4 { color:blue;} 我将它们应用于以下HTML
<div> <h4>International new</h4> <article> <h4 >New Developments!</h4> <asIDe> <h4>Impact On marckets</h4> </asIDe> </article> </div>
为什么Impackt On marckets是蓝色的,我认为它应该是黄色的?
我认为在这种情况下标签应该从内到外应用,而不是相反.它是关于Article标签的吗?
.headline { color:red;}asIDe h4 { Font-style: italic !important; color:yellow;}article h4 { Font-style:normal; color:blue;} <!DOCTYPE HTML><HTML xmlns="http://www.w3.org/1999/xhtml"><head> <Title></Title> <link href="StyleSheet1.CSS" rel="stylesheet" /></head><body> <div> <h4>International new</h4> <article> <h4 >New Developments!</h4> <asIDe> <h4>Impact On marckets</h4> </asIDe> </article> </div></body></HTML>
标签
解决方法 这是因为h4和h4除外具有相同的特异性.鉴于它们具有相同的相关性,将使用CSS文件中的最后一条规则.The specificity is a weight that is applIEd to a given CSS declaration based on the count of each selector type. In the case of specificity equality,the latest declaration found in the CSS is applIEd to the element. Specificity only applIEs when the same element is targeted. CSS rules that directly target an element will always take precedence over rules that an element inherits from an ancestor.
特异性(https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity)
如果在CSS中切换位置,文本将为黄色.
.headline { color:red;}article h4 { Font-style:normal; color:blue;}asIDe h4 { Font-style: italic !important; color:yellow;} <!DOCTYPE HTML><HTML xmlns="http://www.w3.org/1999/xhtml"><head> <Title></Title> <link href="StyleSheet1.CSS" rel="stylesheet" /></head><body> <div> <h4>International new</h4> <article> <h4 >New Developments!</h4> <asIDe> <h4>Impact On marckets</h4> </asIDe> </article> </div></body></HTML>总结
以上是内存溢出为你收集整理的html – CSS Combinator问题全部内容,希望文章能够帮你解决html – CSS Combinator问题所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)