【问题标题】:Hide overflowing table cell content in IE7 with CSS使用 CSS 隐藏 IE7 中溢出的表格单元格内容
【发布时间】:2012-12-07 03:16:49
【问题描述】:

我在表格单元格中有一个锚元素。锚点需要与后续单元格重叠,但在表格外或包含 div 时不可见。

HTML

<div>
  <table>
    <tbody>
      <tr>
        <th><span>Volkswagen Crafter CR30 SWB Diesel 2.5 BlueTDI 88PS Van</span> BF60GKK <br>updated 06 dec 17:49</th>
        <td>a</td>
        <td>z</td>
        <td>b</td>
        <td>c</td>
        <td>y</td>
        <td>x</td>
        <td><a style="width: 237.5%;left:37.5%" href="#"><span>John Smith, Provisional<br/>09:00 on 12 Dec<br/>18:00 on 14 Dec</span></a></td>
        <td>g</td>
      </tr>
    </tbody> 
  </table>
</div>​

CSS

div {overflow:hidden;display:inline-block;position:relative}
th,td {border:1px solid black; border-collapse:collapse; position:relative; width:50px; }
th {width:150px;}
td.d {background-color:#cdc;}
a {z-index:1000;position:absolute;width:300px;top:15px;left:5px;height:60px;overflow:hidden;background:#fdd;}

这适用于 Chrome、IE8 和 IE9……

但在 IE7 中没有……

如何在 IE7 中进行这项工作?

在此处查看工作示例http://jsfiddle.net/UrZDw/

此外,IE7 还将锚点放在具有背景颜色的单元格后面。我该如何解决这个问题?

【问题讨论】:

标签: html css internet-explorer-7


【解决方案1】:
table { overflow: hidden; }

那么你的tds 将继承它,所以你需要明确设置:

table td { overflow: visible; }

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-01-26
  • 2020-06-30
  • 2023-01-10
  • 2011-04-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多