dukaqi 2011-09-27 12:19
浏览 220
已采纳

在ie 7或ie 6里如何让超出td宽度的内容浮动显示在后面的td里

<html>
<body style="font:16px Arial;">
<style type="text/css">
.table {
    border-collapse: collapse;
    table-layout: fixed;
    font: normal 11px arial;
}
.row {
    height:25px;
}
.cell {
    background-color:#ECF4FE;
    font-family:Arial,Verdana,sans-serif;
    font-size: 11px;
    border-bottom-width: 1px;
    border-bottom-color: #ECF4FE;
    border-bottom-style: dotted;
    border-top: none;
    border-left: 1px solid #EC0000;
    border-right: 1px solid #EC0000;
    vertical-align: middle;
    padding-left: 3px;
    padding-right: 3px;
}
</style>
<div style="width: 250px">
<table width="100%" class="table">
  <tr class="row">
    <td class="cell">
      <div style="white-space:nowrap;">Text Text Text Text Text Text Text Text</div>
    </td>
    <td class="cell">
    </td>
    <td class="cell">
    </td>
    <td class="cell">
    </td>
    <td class="cell">
    </td>
  </tr>
</table>
</div>
</body>
</html>

 如题和上述代码,在ie7标准模式下。

 

情形一:

如果表格上面有 table-layout: fixed; 这个样式,上述代码在页面上显示的效果是


情形二:

如果表格上面没有 table-layout: fixed; 这个样式,上述代码在页面上显示的效果是



 很显然这两种结果都不理想。

在我现在的需求里,限于总体设计的因素,table标签上的table-layout: fixed; 是必须要有的。但是我又需要把单元格里超出单元格的那些内容浮动显示在它后面的各个单元格里,不能像情形二里那样直接把第一个单元格拉宽。理想效果如下



 上面的理想效果目前在IE 8,Firefox,Chrome,Safari,Opera这几款浏览器里都实现了,就差ie 7,也许还有ie 6。


忘好心人指点。

  • 写回答

2条回答 默认 最新

  • fire4cwy 2011-10-08 22:12
    关注

    IE9、腾迅浏览器、搜狗浏览器都不行的!!~~

    我帮你改好了,自己收去看看~~

    [code="html"]

    .table {border-collapse: collapse;table-layout: fixed;font: normal 11px arial;} .row {height:25px;} .cell { background-color:#ECF4FE; font-family:Arial,Verdana,sans-serif; font-size: 11px; border-bottom-width: 1px; border-bottom-color: #ECF4FE; border-bottom-style: dotted; border-top: none; border-left: 1px solid #EC0000; border-right: 1px solid #EC0000; vertical-align: top; padding-left: 3px 3px; } .cell .text {white-space:nowrap;position:absolute;height:25px;padding: 5px 0;}
    Text Text Text Text Text Text Text Text



    [/code]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 易语言把MYSQL数据库中的数据添加至组合框
  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况