html - MDL数据表不会一路缩水

标签 html css html-table material-design-lite


我正在尝试找到一种让 MDL 数据表缩小以适应移动设备的好方法。我试过将表格宽度设置为 100%。

只要我也将 table-layout 设置为 fixed(我不确定为什么),这就有效:

table {
  width: 100%;
  table-layout: fixed;
}

但是,当尝试在可选表上使用此方法时,整个表会被推到右边:

enter image description here

如果没有将可选择的类添加到表中,它看起来像这样:

enter image description here

有什么想法吗?

最佳答案

我最终解决了这个问题(感谢 @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/

相关文章:

css - Angular - 单击按钮后更改表中行的背景颜色

javascript - 用 JQuery 迭代表

css - 将复选框的输入样式重置为 IE 中的默认值

javascript - Cylcle2 没有循环寻呼机出现

html - 带有 2 个渐变按钮的 CSS?

html - 将文本和图像排列在同一行

javascript - 使用 jQuery 在表列中的所有单元格上运行函数

javascript - 网站屏幕分辨率自动调整大小

javascript - 使用 async.forEach 循环在异步函数中覆盖变量

css - 在 React JS 中使用淡入淡出时,Bootstrap 4.0.0-beta.3 模态不可见