html - 使 Material Design Lite 表格 100% 宽度的正确方法是什么?

标签 html css material-design-lite

我正在考虑使用 Google's Material Design Lite框架,我想知道如何使表格跨越其包含元素的 100% 宽度:

拿这张表:

<table class="mdl-data-table mdl-js-data-table mdl-data-table--selectable mdl-shadow--2dp">
  <thead>
    <tr>
      <th class="mdl-data-table__cell--non-numeric">Material</th>
      <th>Quantity</th>
      <th>Unit price</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td class="mdl-data-table__cell--non-numeric">Acrylic (Transparent)</td>
      <td>25</td>
      <td>$2.90</td>
    </tr>
    <tr>
      <td class="mdl-data-table__cell--non-numeric">Plywood (Birch)</td>
      <td>50</td>
      <td>$1.25</td>
    </tr>
    <tr>
      <td class="mdl-data-table__cell--non-numeric">Laminate (Gold on Blue)</td>
      <td>10</td>
      <td>$2.35</td>
    </tr>
  </tbody>
</table>

我怎样才能让这个 MDL 表跨越 100% 的容器?

我已经设置了这个 JSFiddle表格示例取自 docs .

最佳答案

只需在tableth 中添加一个新的fullwidth 类,直接将宽度设置为100%。

.fullwidth {
    width: 100%;
}

试试这个 fiddle

关于html - 使 Material Design Lite 表格 100% 宽度的正确方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31259563/

相关文章:

javascript - 从显示为 :none in JavaScript 的父 div 获取 ID

jquery - 使用 jQuery 动画 div

html - Firefox 不水平扩展包含自动宽度图像的 DIV 容器

html - 如何使 Material Design 精简版卡片仅在 X 上滚动并带有 imgs 溢出?

html - 添加填充到最小高度而不是包含它?

javascript - 如何用 ServiceWorker 生命周期替换 appcache 生命周期事件

html - 在导航内时菜单动画不起作用

css - 为什么我的 img 和搜索栏不在我的导航栏中?

css - 如何使用angularjs在引导选项卡中设置路由

html - 在 Chrome 中使用 MDL 固定 header 时如何获得页面内容的 100% 高度?