我正在尝试找到一种让 MDL 数据表缩小以适应移动设备的好方法。我试过将表格宽度设置为 100%。
只要我也将 table-layout 设置为 fixed(我不确定为什么),这就有效:
table {
width: 100%;
table-layout: fixed;
}
但是,当尝试在可选表上使用此方法时,整个表会被推到右边:
如果没有将可选择的类添加到表中,它看起来像这样:
有什么想法吗?
最佳答案
我最终解决了这个问题(感谢 @sweaver2112 的评论),方法是更改表格上的填充以使其变小。
td, th {
padding: 12px 5px;
}
td:first-of-type, th:first-of-type {
padding-left: 15px;
}
td:last-of-type, th:last-of-type {
padding-right: 15px;
}
关于html - MDL数据表不会一路缩水,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49780589/