【发布时间】:2020-12-24 08:43:44
【问题描述】:
用户可以创建自定义表格并以百分比为单位设置列宽,加起来为 100。
问题是这些设置的宽度使移动的桌子变得狭窄。
所以我的目标是在移动设备上使用引导程序“table-responsive”类水平滚动表格。
我尝试为移动媒体查询的表格列添加一个类以覆盖宽度,但这只会使表格更加狭窄。
//css
@media (max-width: 769px) {
.wiki-table-c-width {
width: auto !important;
}
}
//example table html
<div class ="table-responsive">
<table class ="table table-bordered table-striped">
<tr> <td class ="wiki-table-c-width" style ="width: 10%"></td> <td class ="wiki-table-c-width" style ="width: 10%"></td> <td class ="wiki-table-c-width" style ="width: 10%"></td> <td class ="wiki-table-c-width" style ="width: 10%"></td> <td class ="wiki-table-c-width" style ="width: 10%"></td> <td class ="wiki-table-c-width" style ="width: 10%"></td> <td class ="wiki-table-c-width" style ="width: 10%"></td> <td class ="wiki-table-c-width" style ="width: 10%"></td> <td class ="wiki-table-c-width" style ="width: 10%"></td> <td class ="wiki-table-c-width" style ="width: 10%"></td> </tr>
</table>
</div>
所以基本上在桌面上设置宽度。 (它们实际上可以是任何东西,用户可以选择)和自动宽度并在移动设备上水平滚动。
【问题讨论】:
标签: html css twitter-bootstrap html-table