在列之后的html表中强制换行

时间:2017-10-30 10:55:01

标签: html css

我想在row中每table只有4列,如何使用css在表格中强制换行? 请检查我在下面的链接中尝试了什么 -

<table style="table-layout: fixed; width: 100%;">
    <tbody>
        <tr>
            <td style="word-wrap: break-word;overflow-wrap: break-word;width:25%"></td>
            <td style="word-wrap: break-word;overflow-wrap: break-word;width:25%"></td>
            <td style="word-wrap: break-word;overflow-wrap: break-word;width:25%"></td>
            <td style="word-wrap: break-word;overflow-wrap: break-word;width:25%"></td>
            <td style="word-wrap: break-word;overflow-wrap: break-word;width:25%"></td>
        <tr>
    </tbody>
</table>

LINK - jsfiddle

1 个答案:

答案 0 :(得分:0)

我找到了一种使用Bootstrap的简单方法:

<div class="row">
    <div class="col-sm-3" style="background-color:lavender;"><table>...</table></div>
    <div class="col-sm-3" style="background-color:lavenderblush;"><table>...</table></div>
    <div class="col-sm-3" style="background-color:lavender;"><table>...</table></div>
    <div class="col-sm-3" style="background-color:lavenderblush;"><table>...</table></div>
</div>