【发布时间】:2012-02-11 22:19:22
【问题描述】:
我正在使用 DevExpress ASPxMenu。它生成的 html 在每个菜单项之间创建一个 td 元素。我已经问过 DevExpress 我如何通过设置删除这个 td 或添加一个类,他们说无法完成(http://devexpress.com/Support/Center/p/Q281686.aspx,该票也附有示例解决方案)
html/css 看起来像(我添加了背景:红色以突出显示单元格):
<table class="nav-menu" cellspacing="0">
<tr>
<td class="nav-item nav-item-selected">menu 1</td>
<td id="td0" style="height:1px;width:2px;background:red">
<div style="height:1px;width:2px;overflow:hidden;"> </div>
</td>
<td class="nav-item"> menu 2</td>
<td id="td1" style="height:1px;width:2px;background:red">
<div style="height:1px;width:2px;overflow:hidden;"> </div>
</td>
<td class="nav-item"> menu 3</td>
<td id="td2" style="height:1px;width:2px;background:red">
<div style="height:1px;width:2px;overflow:hidden;"> </div>
</td>
<td class="nav-item"> menu 4</td>
<td id="td3" style="height:1px;width:2px;background:red">
<div style="height:1px;width:2px;overflow:hidden;"> </div>
</td>
</tr>
</table>
.nav-menu
{
width:400px;
height:35px;
background: transparent;
}
.nav-menu td
{
display: none;
}
.nav-item
{
font: 1em/1.167em Helvetica,Arial,sans-serif!important;
color: #5A81B3;
padding-left: 4px;
display: table-cell!important;
border: 0px;
border-right-color: #DFE9EF;
border-right-style:Solid;
border-right-width: 1px;
}
.nav-item-selected,
.nav-item:hover
{
color: #5A81B3;
background: url("../images/arrow-nav.gif") no-repeat scroll 8px 100% #DFE9EF;
}
我无法控制带有 id (td id="td0") 的 td,并且我不希望它显示。
上述方法在 FF 和 IE8/9 中效果很好,但在 IE6/7 中效果不佳。我尝试了不同的显示器,但它们只会破坏 FF 和 IE8/9。
我查看了display :table-cell does not work in ie 7? 和IE7 and the CSS table-cell property,但我认为它们对我没有帮助。
所以:
a) 如何让菜单显示类似于 ie6 或 7 中的表格单元格
或
b) 我怎样才能让 ie6 和 7 忽略这条规则
.nav-menu td
{
display: none;
}
如果可以的话,我宁愿避免使用 javascript。我也不想使用下面的规则,因为 id 是由 .net 生成的。
#td0
{
display: none;
}
谢谢
【问题讨论】:
标签: css