如何使我的选择器更具体? [英] How do I make my selectors more specific?
本文介绍了如何使我的选择器更具体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在一个页面中,我使用一个带有自己的样式表的tabstrip。此标签条写入div和锚点。
In a page I use a tabstrip with its own stylesheets. This tabstrip writen with divs and anchors.
我将一些其他div添加到选项卡,但是它们从外部tabstrip继承样式表。这个新的div有自己的css类。
I add some other divs into tabs but they inherit stylesheet from the outer tabstrip. This new divs has their own css classes.
这里是我的问题,有没有办法打破这个继承而不改变CSS的结构?
Here is my question, are there a way to break this inheritance without changing the structure of css ?
Tabs'CSS样式:
Tabs' CSS Styles :
div.tabs {
padding: .5em;
}
div.tabs div.tabs {
padding: 0;
}
div.tabs div.tabs div {
clear: left;
height: 4em;
padding: .5em;
border: 1px solid #003366;
}
新添加的div使用此类:
New added divs use this classes :
.graphTextItem{ font-family:sans-serif; font-size:12px; border: solid 1px #78ACFF; text-align:center; width:150px; }
.graphImageItem{ border-left: solid 1px #78ACFF; border-right: solid 1px #78ACFF; text-align:center; height:70px; }
推荐答案
从此样式表中解决了我的问题:
By removing div from this stylesheet solved my problem :
div.tabs div.tabs {
clear: left;
height: 4em;
padding: .5em;
border: 1px solid #003366;
}
但我还是想知道是否有办法?
But I still wonder whether there is a way ?
这篇关于如何使我的选择器更具体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文