css - Internet Explorer 忽略显示 :inline

标签 css html-table inline

我有一些 Sharepoint 生成的 HTML 标记,它不是您见过的最好的,并且不能干扰标记,但必须通过 CSS 设置样式。

标记大致是这样的:

<div id="searchbox">
<table>
<tr>
<td>
<table class="mstable">
<tr>
<td><input></input></td>
<td><select><option></option><option></option></select></td>
</tr>
</table>
</table>
<div id="fontsize">
<a href=""/>
<a href=""/>
</div>
</div>

这是应用的 CSS

#searchbox {
    float: right;
    margin-right: 15px;
    margin-top: 10px;
    text-align: right;
    width: 40%;
}

#fontsize {
    float: right;
    width: 46px;
}

.mstable {
    border-collapse: collapse;
    margin-left: 2px;
    margin-top: 2px;
    width: 100%;
    color: #000000;
    font-family: Verdana;
    font-size: 0.7em;
    font-style: normal;
    font-weight: normal;
}

我想做的是将 fontsize div 放在表格旁边。目前,在表格之后有一个中断,字体大小 id 在它下面。 here's how it looks

我将 display:inline 设置为搜索框和 fontsize div 的所有表后代,在 Firefox 中我得到了想要的结果,但在 IE(所有版本 8 及以下)中它忽略了它..

我知道我的解决方案是删除这些表并使其仅包含 div,但我不知道是否有这种可能性。

编辑:我通过将 float:left 设置为表和 fontsize div 并为表本身设置宽度(以像素为单位)来解决问题,例如限制它扩展到整个搜索框 div。

最佳答案

这应该为你做:

http://jsfiddle.net/nULYR/8/

适用于 ie7+

编辑

<table>
<tr>    // here is 
<td>    // the problem
<table class="mstable">
<tr>
<td><input></input></td>
<td><select><option></option><option></option></select></td>
</tr>
</table>
</table>

与:http://jsfiddle.net/nULYR/13/

没有:http://jsfiddle.net/nULYR/12/

关于css - Internet Explorer 忽略显示 :inline,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6841727/

相关文章:

c++ - 内联替换会导致多线程代码中的无限循环吗?

g++ - 如何摆脱g++中的 "inline function used but never defined"警告

html - 将 PSD 转换为 HTML 和 CSS

html - 使用 Bootstrap 3 为不同屏幕尺寸设计网站样式

javascript - 具有调整大小事件的等高行

html - 如何根据主页设置自动表格宽度?

javascript - 使用 getElementById 创建表仅显示最后一个实例

jquery - 悬停在对象上时获取对象的 "original"(非悬停)背景颜色

html - 添加行时 Firefox 单元格边框呈现错误

c++ - 在 .cpp 中的类主体外部定义内联函数