问题描述
我正在使用AjaxControlToolkit CalendarExtender。我的样式表中的一些先前的规则影响日历中的div。
I am using AjaxControlToolkit CalendarExtender. Some previous rule in my stylesheet is affecting div's within the calendar.
div#paymentRegion div
{
float:left;
width:49%;
}
日历中的DIV被强制为49%。我如何让日历忽略以前的设置并使用日历附带的样式?那可能吗?我害怕改变目前的规则,但我认为它可能需要,但是这个控制的其他许多div都依赖于它。什么是>符号符合css规则。例如
There are DIVs within the calendar that are being forced to 49%. How can I have the calendar ignore the previous settings and use the styles that come with the calendar? Is that possible? I am afraid to change the current rule, but I think it probably needs to be, however many other divs on this control rely on it. What does the > symbol do to a css rule. For example
div#paymentRegion > div
{
float:left;
width:49%;
}
也许这会有帮助吗?我很乐意提供任何建议。
感谢,
〜ck在圣地亚哥
Maybe that will help? I am open for any suggestions.Thanks,~ck in San Diego
推荐答案
理论上, >
符号将只选择 div
s,它们是#paymentRegion的直接子节点。向下嵌套的 div
不会受到影响。 然而,并非所有的浏览器都能正确解释,因此它不是您可以可靠使用的。
Theoretically, the >
symbol would select only div
s that are immediate children of #paymentRegion. A div
nested farther down would be unaffected. However, not all browsers interpret that correctly, so it's not something you can reliably use.
更直接的解决方案是将日历a < div id =calendar>
,然后写出一个覆盖规则:
A more direct solution is to wrap your calendar in a <div id="calendar">
and then write an overriding rule:
div#paymentRegion div {
float: left;
width: 49%;
}
div#calendar div {
float: none;
width: auto;
}
现在即使大多数 div
里面的#paymentRegion将浮动,#calendar内的div不会!
Now even though most div
s inside #paymentRegion will be floated, the divs inside #calendar won't be!
这篇关于CSS帮助 - DIV如何忽略之前在页面上设置的CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!