我正在尝试使用MDL建立一个网站。但是,当在网格中使用卡片时,当卡片比该行中的其他卡片小时,卡片动作不会与底部对齐,如下所示:
似乎支持的文本没有按照我的意愿进行扩展,但是不确定如何做到这一点。以下是HTML中的相关代码段:
<!-- Content -->
<main class="mdl-layout__content">
<div class="mdl-grid">
<!-- Short supporting text -->
<div class="home-card mdl-cell mdl-cell--4-col mdl-cell--8-col-tablet mdl-card mdl-shadow--2dp">
<div class="mdl-card__title">
<h2 class="mdl-card__title-text">Blog</h2>
</div>
<div class="mdl-card__supporting-text">
A fairly recent addition detailing some of the work done on current projects.
</div>
<div class="mdl-card__actions mdl-card--border">
<a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">Visit Blog</a>
</div>
<div class="mdl-card__menu">
<button class="mdl-button mdl-button--icon mdl-js-button mdl-js-ripple-effect">
<i class="material-icons">share</i>
</button>
</div>
</div>
<!-- Long supporting text -->
<div class="home-card mdl-cell mdl-cell--4-col mdl-cell--8-col-tablet mdl-card mdl-shadow--2dp">
<div class="mdl-card__title">
<h2 class="mdl-card__title-text">Blog</h2>
</div>
<div class="mdl-card__supporting-text">
A fairly recent addition detailing some of the work done on current projects.
A fairly recent addition detailing some of the work done on current projects.
</div>
<div class="mdl-card__actions mdl-card--border">
<a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">Visit Blog</a>
</div>
<div class="mdl-card__menu">
<button class="mdl-button mdl-button--icon mdl-js-button mdl-js-ripple-effect">
<i class="material-icons">share</i>
</button>
</div>
</div>
</div>
</main>
...和CSS:
.home-card > .mdl-card__title {
color: #fff;
height: 176px;
background: url('../assets/coding-banner.jpg') center / cover;
padding: 0
}
.home-card > .mdl-card__title > .mdl-card__title-text {
width: 100%;
padding: 16px;
background: rgba(0, 0, 0, 0.3);
}
.home-card > .mdl-card__menu {
color: #fff;
}
最佳答案
德普我需要在支持的文本div中添加mdl-card--expand
。
<div class="mdl-card__supporting-text mdl-card--expand">
A fairly recent addition detailing some of the work done on current projects.
</div>