如何忽略父CSS样式 [英] How to ignore parent css style
本文介绍了如何忽略父CSS样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何忽略父样式并使用默认样式(无)。我将以我的具体案例为例,但我确定这是一个一般的问题。
I'm wondering how to ignore a parent style and use the default style (none). I'll show my specific case as an example but I'm pretty sure this is a general question.
<style>
#elementId select {
height:1em;
}
</style>
<div id="elementId">
<select name="funTimes" style="" size="5">
<option value="test1">fish</option>
<option value="test2">eat</option>
<option value="test3">cows</option>
</select>
</div>
我不想解决这个问题:
- 我无法编辑样式表中设置#elementId select的设置,我的模块将无法访问。
- 最好不要使用style属性重写height style。
例如使用firebug我可以关闭父风格,一切都很好,这是我要的效果。
For example using firebug i can turn off the parent style and all is well, this is the effect I am going for.
设置样式后,是否可以停用或必须重写样式?
推荐答案
它必须被覆盖。您可以使用:
It must be overridden. You could use:
<!-- Add a class name to override -->
<select name="funTimes" class="funTimes" size="5">
#elementId select.funTimes {
/* Override styles here */
}
您可以使用属性选择器,但由于旧版浏览器不支持(读取IE6等),最好添加类名
You could use an attribute selector, but since that isn't supported by legacy browsers (read IE6 etc), it's better to add a class name
这篇关于如何忽略父CSS样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文