MDL数据table不会一路缩水
MDL data table will not shrink all the way
我正在尝试找到一种允许 MDL 数据 table 缩小以适合移动设备的好方法。我尝试将 table 宽度设置为 100%。
只要我也将 table-layout 设置为 fixed(我不确定为什么),这就有效:
table {
width: 100%;
table-layout: fixed;
}
但是,当尝试在选择上使用此方法时table table 整个 table 被推到右边:
没有选择 table class 添加到 table 它看起来像这样:
有什么想法吗?
我最终通过更改 table 上的填充以使其更小来解决这个问题(感谢 @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;
}
我正在尝试找到一种允许 MDL 数据 table 缩小以适合移动设备的好方法。我尝试将 table 宽度设置为 100%。
只要我也将 table-layout 设置为 fixed(我不确定为什么),这就有效:
table {
width: 100%;
table-layout: fixed;
}
但是,当尝试在选择上使用此方法时table table 整个 table 被推到右边:
没有选择 table class 添加到 table 它看起来像这样:
有什么想法吗?
我最终通过更改 table 上的填充以使其更小来解决这个问题(感谢 @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;
}