html - TD背景不显示

标签 html css

我有这个 CSS 样式:

table.shadowed {
    border-spacing: 0px;
}

table.shadowed td {
    padding: 0px;
}

table.information {
    width: 500px;
}

table.information td.ul {
    background-image: url('img/information_bg_upper_left.png');
    background-position: bottom;
    background-repeat: no-repeat;
    width: 10px;
    height: 36px;
}

table.information td.u {
    background-image: url('img/information_bg_upper.png');
    background-position: bottom;
    background-repeat: repeat-x;
}

和这个 HTML 代码片段:

<table class="shadowed information">
    <tr>
        <td class="ul"></td>
        <td class="u"></td>
        <td></td>
    </tr>
    <tr>
        <td></td>
        <td></td>
        <td></td>
    </tr>
    <tr>
        <td></td>
        <td></td>
        <td></td>
    </tr>
</table>

它的问题是,对我来说,中心 TD 的背景在 Firefox 中可以很好地看到,但在 Chrome 或 Opera 中则不能。

这很有趣,因为我设置了repeat-x

那么您有任何答案吗?为什么会这样?如何在不设置具体尺寸的情况下为表格单元格设置背景?

谢谢,Áron。

最佳答案

为了使背景可见,单元格必须填充文本之类的内容,或者设置宽度和高度,否则它会折叠并且无法看到背景。

关于html - TD背景不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14364623/

相关文章:

html - 为什么网页不能平滑滚动?

html - 即使选中复选框也不会提交

javascript - Velocity.js。将 {bottom, top} 重置为 "auto"不起作用,它仍然是 "0px"

html - 我的导航不会显示为内联 block

javascript - Div 没有切换 html 按钮

html - 有没有办法强制一个类在另一个元素之后显示而不隐藏它?

javascript - 在 javascript 中循环 html 复选框

css - slider 顶部的 Div

jquery - 网页反馈

css - 无法阻止 css 继承