在 material-design-lite 中的全宽卡之间添加垂直 space
Add vertical space between full width card in material-design-lite
如何在MDL卡组件之间添加space?
<div class="demo-card-event mdl-card mdl-shadow--2dp">
<div class="mdl-card__title mdl-card--expand">
<h4>
Featured event:<br>
May 24, 2016<br>
7-11pm
</h4>
</div>
<div class="mdl-card__actions mdl-card--border">
<a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">
Add to Calendar
</a>
<div class="mdl-layout-spacer"></div>
<i class="material-icons">event</i>
</div>
</div>
<div class="demo-card-event mdl-card mdl-shadow--2dp">
<div class="mdl-card__title mdl-card--expand">
<h4>
Featured event:<br>
May 24, 2016<br>
7-11pm
</h4>
</div>
<div class="mdl-card__actions mdl-card--border">
<a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">
Add to Calendar
</a>
<div class="mdl-layout-spacer"></div>
<i class="material-icons">event</i>
</div>
</div>
这是卡片组件,卡片之间没有 space 它们完全首尾相连。
是否有任何内置 class 可以添加 space 或我们需要手动添加,或者我的代码是否有任何错误。
尝试添加 mdl-layout-spacer
class 仍然无效。
找到一个没有人回答的旧线程。
Vertical adjustment between cards in Material Design Lite
编辑:
这是添加网格的正确方法吗?
<div class="mdl-grid" style="max-width: 90%;">
<div class="mdl-cell mdl-cell--9-col mdl-card mdl-shadow--4dp">
</div>
<div class="mdl-cell mdl-cell--3-col mdl-typography--text-center">
<div class="mdl-grid">
<div class="mdl-cell mdl-cell--12-col mdl-card mdl-shadow--2dp">
<div class="mdl-card__title mdl-card--expand">
<h4>
Featured event:<br>
May 24, 2016<br>
7-11pm
</h4>
</div>
<div class="mdl-card__actions mdl-card--border">
<a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">
Add to Calendar
</a>
<div class="mdl-layout-spacer"></div>
<i class="material-icons">event</i>
</div>
</div>
</div>
</div>
</div>
您可以在卡片周围添加行包装器并向卡片添加一个单元格 class,或者将每张卡片包裹在一个单元格中 class,具体取决于您想要的效果。
<script src="https://code.getmdl.io/1.3.0/material.min.js"></script>
<link href="https://code.getmdl.io/1.3.0/material.indigo-pink.min.css" rel="stylesheet"/>
<div class="mdl-grid" style="max-width: 90%;">
<div class="mdl-cell mdl-cell--9-col mdl-cell--8-col-tablet mdl-card mdl-shadow--4dp">
</div>
<div class="mdl-cell mdl-cell--3-col mdl-cell--8-col-tablet mdl-typography--text-center">
<div class="mdl-grid">
<div class="mdl-grid">
<div class="mdl-cell mdl-cell--6-col mdl-cell--4-col-tablet demo-card-event mdl-card mdl-shadow--2dp">
<div class="mdl-card__title mdl-card--expand">
<h4>
Featured event:<br>
May 24, 2016<br>
7-11pm
</h4>
</div>
<div class="mdl-card__actions mdl-card--border">
<a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">
Add to Calendar
</a>
<div class="mdl-layout-spacer"></div>
<i class="material-icons">event</i>
</div>
</div>
<div class="mdl-cell mdl-cell--6-col mdl-cell--4-col-tablet demo-card-event mdl-card mdl-shadow--2dp">
<div class="mdl-card__title mdl-card--expand">
<h4>
Featured event:<br>
May 24, 2016<br>
7-11pm
</h4>
</div>
<div class="mdl-card__actions mdl-card--border">
<a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">
Add to Calendar
</a>
<div class="mdl-layout-spacer"></div>
<i class="material-icons">event</i>
</div>
</div>
</div>
</div>
</div>
使用嵌套网格更新。
如何在MDL卡组件之间添加space?
<div class="demo-card-event mdl-card mdl-shadow--2dp">
<div class="mdl-card__title mdl-card--expand">
<h4>
Featured event:<br>
May 24, 2016<br>
7-11pm
</h4>
</div>
<div class="mdl-card__actions mdl-card--border">
<a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">
Add to Calendar
</a>
<div class="mdl-layout-spacer"></div>
<i class="material-icons">event</i>
</div>
</div>
<div class="demo-card-event mdl-card mdl-shadow--2dp">
<div class="mdl-card__title mdl-card--expand">
<h4>
Featured event:<br>
May 24, 2016<br>
7-11pm
</h4>
</div>
<div class="mdl-card__actions mdl-card--border">
<a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">
Add to Calendar
</a>
<div class="mdl-layout-spacer"></div>
<i class="material-icons">event</i>
</div>
</div>
这是卡片组件,卡片之间没有 space 它们完全首尾相连。
是否有任何内置 class 可以添加 space 或我们需要手动添加,或者我的代码是否有任何错误。
尝试添加 mdl-layout-spacer
class 仍然无效。
找到一个没有人回答的旧线程。
Vertical adjustment between cards in Material Design Lite
编辑:
这是添加网格的正确方法吗?
<div class="mdl-grid" style="max-width: 90%;">
<div class="mdl-cell mdl-cell--9-col mdl-card mdl-shadow--4dp">
</div>
<div class="mdl-cell mdl-cell--3-col mdl-typography--text-center">
<div class="mdl-grid">
<div class="mdl-cell mdl-cell--12-col mdl-card mdl-shadow--2dp">
<div class="mdl-card__title mdl-card--expand">
<h4>
Featured event:<br>
May 24, 2016<br>
7-11pm
</h4>
</div>
<div class="mdl-card__actions mdl-card--border">
<a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">
Add to Calendar
</a>
<div class="mdl-layout-spacer"></div>
<i class="material-icons">event</i>
</div>
</div>
</div>
</div>
</div>
您可以在卡片周围添加行包装器并向卡片添加一个单元格 class,或者将每张卡片包裹在一个单元格中 class,具体取决于您想要的效果。
<script src="https://code.getmdl.io/1.3.0/material.min.js"></script>
<link href="https://code.getmdl.io/1.3.0/material.indigo-pink.min.css" rel="stylesheet"/>
<div class="mdl-grid" style="max-width: 90%;">
<div class="mdl-cell mdl-cell--9-col mdl-cell--8-col-tablet mdl-card mdl-shadow--4dp">
</div>
<div class="mdl-cell mdl-cell--3-col mdl-cell--8-col-tablet mdl-typography--text-center">
<div class="mdl-grid">
<div class="mdl-grid">
<div class="mdl-cell mdl-cell--6-col mdl-cell--4-col-tablet demo-card-event mdl-card mdl-shadow--2dp">
<div class="mdl-card__title mdl-card--expand">
<h4>
Featured event:<br>
May 24, 2016<br>
7-11pm
</h4>
</div>
<div class="mdl-card__actions mdl-card--border">
<a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">
Add to Calendar
</a>
<div class="mdl-layout-spacer"></div>
<i class="material-icons">event</i>
</div>
</div>
<div class="mdl-cell mdl-cell--6-col mdl-cell--4-col-tablet demo-card-event mdl-card mdl-shadow--2dp">
<div class="mdl-card__title mdl-card--expand">
<h4>
Featured event:<br>
May 24, 2016<br>
7-11pm
</h4>
</div>
<div class="mdl-card__actions mdl-card--border">
<a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">
Add to Calendar
</a>
<div class="mdl-layout-spacer"></div>
<i class="material-icons">event</i>
</div>
</div>
</div>
</div>
</div>
使用嵌套网格更新。