国产成人精品无码青草_亚洲国产美女精品久久久久∴_欧美人与鲁交大毛片免费_国产果冻豆传媒麻婆精东

18143453325 在線咨詢 在線咨詢
18143453325 在線咨詢
所在位置: 首頁 > 營銷資訊 > 建站知識(shí) > html解決table設(shè)置寬度無效的問題

html解決table設(shè)置寬度無效的問題

時(shí)間:2023-03-03 07:06:01 | 來源:建站知識(shí)

時(shí)間:2023-03-03 07:06:01 來源:建站知識(shí)

html解決table設(shè)置寬度無效的問題:

這篇文章主要介紹了html解決table設(shè)置寬度無效的問題,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

如果對(duì)table設(shè)置table-layer:fixed樣式后,發(fā)現(xiàn)表格中有一行合并過,其它沒有合并的行的列寬會(huì)平均化,對(duì)列寬的設(shè)置會(huì)失效。

解決方法:

        <col style="width: 100px;"/>
        <col>
        <col style="width: 100px;"/>
        <col style="width: 100px;"/>
        <col style="width: 100px;"/>

在tbody前面加

.detail {
    padding-bottom: 50px;
    margin-top: 80px;
}

.detail_table {
    table-layout:fixed;/*列寬由表格寬度和列寬度設(shè)定。*/
    margin: auto;/*table居中*/
    text-align: center;
    border: 1px solid #804040;
    border-collapse: collapse;
}

.detail_table th {
    padding: 26px;;
}

.detail_table td {
    border: 1px solid #804040;
    padding-top: 16px;
    padding-bottom: 16px;
}

.special {
    text-align: left;
    padding-left: 20px;
}

<div class="detail">

    <table class="detail_table">

        <thead>
        <th colspan="5">選擇的選項(xiàng)明細(xì)</th>
        </thead>
        <!--寫的話就按照你寫的寬度,但是如果你寫的寬度占不滿table它會(huì)按照你給的尺寸的比例平分至每個(gè)td-->
        <!--現(xiàn)在這么寫就是四列是100px,沒給數(shù)據(jù)的那一列占剩下的全部-->
        <col style="width: 100px;"/>
        <col>
        <col style="width: 100px;"/>
        <col style="width: 100px;"/>
        <col style="width: 100px;"/>

        <tbody>

        <tr>
            <td>
                序號(hào)
            </td>
            <td>
                癥狀
            </td>
            <td>
                符合
            </td>
            <td>
                不符合
            </td>
            <td>
                不確定
            </td>
        </tr>

        <?php $i = 1; ?>

        <?php foreach ($test as $item): ?>
            <!--拿到選擇項(xiàng)-->
            <?php $temp = $this->session->userdata('b' . $i) ?>

            <tr>

                <td>
                    <?php echo $i; ?>
                </td>

                <td>
                    <?php echo $item; ?>
                </td>

                <td>
                    <?php if ($temp == 1): ?>√<?php endif ?>
                </td>
                <td>
                    <?php if ($temp == 2): ?>√<?php endif ?>
                </td>

                <td>
                    <?php if ($temp == 3): ?>√<?php endif ?>
                </td>

            </tr>

            <?php $i++; ?>

        <?php endforeach; ?>

        </tbody>

    </table>

</div>

到此這篇關(guān)于html解決table設(shè)置寬度無效的問題的文章就介紹到這了,更多相關(guān)table設(shè)置寬度無效內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!

來源:腳本之家

鏈接:https://www.jb51.net/web/738041.html

關(guān)鍵詞:無效,解決,設(shè)置,寬度

74
73
25
news

版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。

為了最佳展示效果,本站不支持IE9及以下版本的瀏覽器,建議您使用谷歌Chrome瀏覽器。 點(diǎn)擊下載Chrome瀏覽器
關(guān)閉