表格宽度在IE中不适应

时间:2015-06-01 03:01:04

标签: html css internet-explorer

表在IE浏览器中不显示全角。如何使表格的宽度不依赖于列宽,例如100px * 3,但取决于窗口宽度?

CSS代码:

table {
    border-collapse: collapse;
    border-spacing: 0;
    background-color: transparent;
    width: 100%;
    table-layout: fixed;
}

HTML代码:

    <table class="table table-hover table-bordered">
        <thead>
            <tr>
                <th style="width: 100px;">xxx</th>
                <th style="width: 100px;">xxx</th>
                <th style="width: 100px;">xxx</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td></td>
                <td></td>
                <td></td>
            </tr>
            <tbody>
    </table>

请注意,Chrome或Firefox中不存在此问题。

1 个答案:

答案 0 :(得分:0)

尝试将宽度属性放在100%

的表中
<table width="100%" class="table table-hover table-bordered">
 <thead>
            <tr>
                <th style="width: 100px;">xxx</th>
                <th style="width: 100px;">xxx</th>
                <th style="width: 100px;">xxx</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td></td>
                <td></td>
                <td></td>
            </tr>
            <tbody>
    </table>