表格单元格未在Firefox,IE中对齐

时间:2014-07-07 10:01:31

标签: html css browser html-table

我试图创建一个第一列已修复的表。我已经以某种方式完成了这项工作,但我无法在所有浏览器中获得相同的结果。结果仅在Chrome上正确无误。这是我在Firefox / IE 8上的结果:

enter image description here

以及Chrome上的内容:

enter image description here

这是我的HTML代码:

<div id="riassuntoOreTecnico">

<table id="riassuntoOreTecnicoTable" >
    <tr>
        <th>Technician Name</th>
        <td style="padding-left:165px"></td>
        <td>Table Cell</td>
        <td>Table Cell</td>
        <td>Table Cell</td>
    </tr>   
    <tr>
        <th>Table Cell</th>
        <td style="padding-left:165px"></td>
        <td>Table Cell</td>
        <td>Table Cell</td>
        <td>Table Cell</td>
        <td>Table Cell</td>
        <td>Table Cell</td>
        <td>Table Cell</td>
        <td>Table Cell</td>
        <td>Table Cell</td>
        <td>Table Cell</td>
        <td>Table Cell</td>
        <td>Table Cell</td>
        <td>Table Cell</td>
        <td>Table Cell</td>
        <td>Table Cell</td>
        <td>Table Cell</td>
        <td>Table Cell</td>
        <td>Table Cell</td>
        <td>Table Cell</td>
        <td>Table Cell</td>
        <td>Table Cell</td>
        <td>Table Cell</td>
        <td>Table Cell</td>
        <td>Table Cell</td>

        <td>Table Cell</td>
    </tr>
</table>

</div>

CSS:

#riassuntoOreTecnico {
    width: 94%;
    float: left;
    margin: 30px 35px;
    overflow-x: scroll;
    overflow-y: visible;
}

#riassuntoOreTecnicoTable {
/*  border-collapse: separate;*/
    border: 1px solid #ddd;
    float: left;
}

#riassuntoOreTecnicoTable th {
    background: #d5d5d5;
    font-weight: bold;
    padding: 5px 8px;
    position: absolute;
    top:auto;
    width:158px;
}

#riassuntoOreTecnicoTable td {
    border: 1px solid #d5d5d5;
    padding: 5px 8px;
}

有人能用我的代码建议这里有什么问题,所以我也可以在firefox / IE8上得到相同的结果吗?

1 个答案:

答案 0 :(得分:0)

我已将white-space:normal添加到表格CSS中并为我修复了它。

以下是更新后的代码:

#riassuntoOreTecnicoTable {
/*  border-collapse: separate;*/
    border: 1px solid #ddd;
    float: left;
    white-space:normal
}

谢谢大家。