【问题标题】:CSS does not apply to IE<8CSS 不适用于 IE<8
【发布时间】:2012-10-29 21:48:55
【问题描述】:
.csstdhighlight
{
    border-left-color: Red;
    border-right-color: Red;
    border-bottom-color: Red;
    border-top-color: Red;
    border-style: solid;
    border-width: 1px;
    background-color: White;
}
<html>
<body>
<style type="text/css" media="screen">
    .csstdhighlight
    {
        border:1px solid red;
        background-color: White;
    }
</style>
<table>
    <tr>
        <td class="csstdhighlight">foo</td>
        <td>bar</td>
    </tr>
</table>
</body>
</html>

我正在为表格单元格应用边框,但 CSS 不适用于早于 8 的 IE 版本。

【问题讨论】:

  • 你知道的,这可以简化为border: 1px solid red; background: white;
  • 我检查你的代码背景是否适用,但边框不适用
  • 请发布您的 css 应用到的 html,如果可能,请创建一个 jsfiddle.net 显示问题以供测试。
  • 我刚刚检查了你的小提琴。它在 IE7 中运行良好。

标签: html css internet-explorer


【解决方案1】:

这在 IE 6/7 中适用于我:

<html>
<body>
<style type="text/css" media="screen">
    .csstdhighlight
    {
        border:1px solid red;
        background-color: White;
    }
</style>
<table>
    <tr>
        <td class="csstdhighlight">foo</td>
        <td>bar</td>
    </tr>
</table>
</body>
</html>

“foo”周围的表格单元格有一个红色边框。 http://jsfiddle.net/rUcnv/

【讨论】:

    【解决方案2】:

    您的 CSS 没有问题,这里的问题是您的表格单元格没有内容。在 IE7 中不存在空表格单元格,这意味着不会呈现边框样式。

    查看空单元here相关话题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-11-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多