W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
用于控制表格布局算法的功能類。
Class
|
Properties
|
---|---|
table-auto | table-layout: auto; |
table-fixed | table-layout: fixed; |
使用 ?table-auto
? 允許表格自動調(diào)整列的大小以適應(yīng)單元格的內(nèi)容。
<table class="table-auto">
<thead>
<tr>
<th>Title</th>
<th>Author</th>
<th>Views</th>
</tr>
</thead>
<tbody>
<tr>
<td>Intro to CSS</td>
<td>Adam</td>
<td>858</td>
</tr>
<tr class="bg-emerald-200">
<td>A Long and Winding Tour of the History of UI Frameworks and Tools and the Impact on Design</td>
<td>Adam</td>
<td>112</td>
</tr>
<tr>
<td>Intro to JavaScript</td>
<td>Chris</td>
<td>1,280</td>
</tr>
</tbody>
</table>
使用 ?table-fixed
? 允許表格忽略內(nèi)容,使用固定的列寬。第一行的寬度將設(shè)置整個表格的列寬。
您可以手動設(shè)置一些列的寬度,其余的可用寬度將被平均分配給沒有明確寬度的列。
<table class="table-fixed">
<thead>
<tr>
<th class="w-1/2 ...">Title</th>
<th class="w-1/4 ...">Author</th>
<th class="w-1/4 ...">Views</th>
</tr>
</thead>
<tbody>
<tr>
<td>Intro to CSS</td>
<td>Adam</td>
<td>858</td>
</tr>
<tr class="bg-blue-200">
<td>A Long and Winding Tour of the History of UI Frameworks and Tools and the Impact on Design</td>
<td>Adam</td>
<td>112</td>
</tr>
<tr>
<td>Intro to JavaScript</td>
<td>Chris</td>
<td>1,280</td>
</tr>
</tbody>
</table>
默認情況下, 針對 table layout 功能類,只生成 responsive 變體。
您可以通過修改您的 ?tailwind.config.js
? 文件中的 ?variants
?部分中的 ?tableLayout
?屬性來控制為 table layout 功能生成哪些變體。
例如,這個配置也將生成 hover and focus 變體:
// tailwind.config.js
module.exports = {
variants: {
extend: {
// ...
tableLayout: ['hover', 'focus'],
}
}
}
如果您不打算在您的項目中使用 table layout 功能,您可以通過在配置文件的 ?corePlugins
?部分將 ?tableLayout
?屬性設(shè)置為 ?false
?來完全禁用它們:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
tableLayout: false,
}
}
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: