我正在尝试使用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;
}
答案 0 :(得分:0)
DERP。将mdl-card--expand
添加到支持文本div是我需要的。
<div class="mdl-card__supporting-text mdl-card--expand">
A fairly recent addition detailing some of the work done on current projects.
</div>