css - 子元素样式没有覆盖公共样式
本文介绍了css - 子元素样式没有覆盖公共样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
为什么<p class="bb">
没有覆盖公共样式?
<head>
<style type="text/css">
.aa div p{
width:200px;
height:200px;
background:blue;
}
.bb{
width:100px;
height:100px;
background:red;
}
</style>
</head>
<body>
<div class="aa">
<div>
<p class="bb"></p>
</div>
<div>
<p></p>
</div>
</div>
</body>
解决方案
css选择器优先级<----传送门.aa div p
的优先级比.bb
高。
然后你可以再研究些一手资料。
这篇关于css - 子元素样式没有覆盖公共样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文