Layout Grid

材料设计的响应用户界面基于列变量网格布局。它在桌面上有12列,在平板电脑上有8列,在电话上有4列。

使用

  1. import * as css from 'omim/layout-grid'

在 HTML 中使用对应的 class:

  1. <div>
  2. <h3 class="mdc-typography--subtitle1">Columns</h3>
  3. <div class="mdc-layout-grid demo-grid">
  4. <div class="mdc-layout-grid__inner">
  5. <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-6 demo-cell"></div>
  6. <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-3 demo-cell"></div>
  7. <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-2 demo-cell"></div>
  8. <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-1 demo-cell"></div>
  9. <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-3 demo-cell"></div>
  10. <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-1 demo-cell"></div>
  11. <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-8 demo-cell"></div>
  12. </div>
  13. </div>
  14. <h3 class="mdc-typography--subtitle1">Grid Left Alignment</h3>
  15. <p class="mdc-typography--body2">This requires a max-width on the top-level grid element.</p>
  16. <div class="mdc-layout-grid mdc-layout-grid--align-left demo-grid demo-grid--alignment">
  17. <div class="mdc-layout-grid__inner">
  18. <div class="mdc-layout-grid__cell demo-cell"></div>
  19. <div class="mdc-layout-grid__cell demo-cell"></div>
  20. <div class="mdc-layout-grid__cell demo-cell"></div>
  21. </div>
  22. </div>
  23. <h3 class="mdc-typography--subtitle1">Right Alignment</h3>
  24. <p class="mdc-typography--body2">This requires a max-width on the top-level grid element.</p>
  25. <div class="mdc-layout-grid mdc-layout-grid--align-right demo-grid demo-grid--alignment">
  26. <div class="mdc-layout-grid__inner">
  27. <div class="mdc-layout-grid__cell demo-cell"></div>
  28. <div class="mdc-layout-grid__cell demo-cell"></div>
  29. <div class="mdc-layout-grid__cell demo-cell"></div>
  30. </div>
  31. </div>
  32. <h3 class="mdc-typography--subtitle1">Cell Alignment</h3>
  33. <p class="mdc-typography--body2">Cell alignment requires a cell height smaller than the inner height of the
  34. grid.</p>
  35. <div class="mdc-layout-grid demo-grid demo-grid--cell-alignment">
  36. <div class="mdc-layout-grid__inner demo-inner">
  37. <div class="mdc-layout-grid__cell mdc-layout-grid__cell--align-top demo-cell demo-cell--alignment"></div>
  38. <div class="mdc-layout-grid__cell mdc-layout-grid__cell--align-middle demo-cell demo-cell--alignment"></div>
  39. <div class="mdc-layout-grid__cell mdc-layout-grid__cell--align-bottom demo-cell demo-cell--alignment"></div>
  40. </div>
  41. </div>
  42. </div>