我希望能夠使容器具有相同的高度 - 即使其內容文本的數量不相同,也不設置固定高度。正如你可以在codepen鏈接上看到的那樣,容器沒有相同的高度,並且沒有與頂部對齊。基本上我想要實現的行爲是讓所有容器具有相同的高度(等於容器高度最大),因此容器必須從頂部和底部對齊。具有相同高度的容器未從頂部對齊
.info-block-tile-table{
position: relative;
overflow: hidden;
display: table;
table-layout: fixed;
margin-bottom: 1rem;
width: 100%;
}
.info-block-tile-row{
display: table-row;
}
.info-block-tile-cell{
width: 25%;
display: table-cell;
float: none;
padding: 1rem;
}
.info-block-tile {
border-top: 5px solid #69be28;
border-right: 1px solid #dfe1e4;
border-left: 1px solid #dfe1e4;
border-bottom: 1px solid #dfe1e4;
float: left;
padding: 0.5rem
}
<div>
<div class="info-block-tile-table">
<div class="info-block-tile-row">
<div class="info-block-tile-cell">
<div class="info-block-tile">
<h6 class="margin-top__0 margin-bottom__2 fiord font-weight-sourcesans__bold">Offering 1</h6>
<p class="margin-top__0 margin-bottom__2 fiord font-weight-sourcesans__normal font-size__7">Lorem ipsum dolor
sit amet, ius fastidii similique argumentum in, porro putent consetetur vix ut. Tibique percipitur ex vim,
vim id idque soleat tibique, has te erant doctus complectitur. Nusquam oportere vituperata id cum, adipisci
persecuti an pro. Eu vim facer graecis, id nec dicta integre interpretaris</p>
<a href="http://www.google.com"
class="aligned-bottom text-decoration__none rounded__thick corporateGreen white__hover background-corporateGreen__hover border border-width__2 font-size__6 padding-topbottom__1 margin-top__4 padding-leftright__4 position-float__left"
target="_blank">
<i class="fa fa-chevron-right"></i>
Learn More
</a>
</div>
</div>
<div class="info-block-tile-cell">
<div class="info-block-tile">
<h6 class="margin-top__0 margin-bottom__2 fiord font-weight-sourcesans__bold">Offering 1</h6>
<p class="margin-top__0 margin-bottom__2 fiord font-weight-sourcesans__normal font-size__7">Lorem ipsum dolor
sit amet, ius fastidii similique argumentum in, porro putent consetetur vix ut. Tibique </p>
<a href="http://www.google.com"
class="aligned-bottom text-decoration__none rounded__thick corporateGreen white__hover background-corporateGreen__hover border border-width__2 font-size__6 padding-topbottom__1 margin-top__4 padding-leftright__4 position-float__left"
target="_blank">
<i class="fa fa-chevron-right"></i>
Learn More
</a>
</div>
</div>
<div class="info-block-tile-cell">
<div class="info-block-tile">
<h6 class="margin-top__0 margin-bottom__2 fiord font-weight-sourcesans__bold">Offering 1</h6>
<p class="margin-top__0 margin-bottom__2 fiord font-weight-sourcesans__normal font-size__7">Lorem ipsum dolor
sit amet, ius fastidii similique argumentum in, porro putent consetetur vix ut. Tibique percipitur ex vim,
vim id idque soleat tibique, has te erant doctus complectitur. Nusquam oportere vituperata id cum, adipisci
persecuti an pro. Eu vim facer graecis, id nec dicta integre interpretaris</p>
<a href="http://www.google.com"
class="aligned-bottom text-decoration__none rounded__thick corporateGreen white__hover background-corporateGreen__hover border border-width__2 font-size__6 padding-topbottom__1 margin-top__4 padding-leftright__4 position-float__left"
target="_blank">
<i class="fa fa-chevron-right"></i>
Learn More
</a>
</div>
</div>
</div>
<div class="info-block-tile-row">
<div class="info-block-tile-cell">
<div class="info-block-tile">
<h6 class="margin-top__0 margin-bottom__2 fiord font-weight-sourcesans__bold">Offering 1</h6>
<p class="margin-top__0 margin-bottom__2 fiord font-weight-sourcesans__normal font-size__7">Lorem ipsum dolor
sit amet, ius fastidii similique argumentum in, porro putent consetetur vix ut. T
</p>
<a href="http://www.google.com"
class="aligned-bottom text-decoration__none rounded__thick corporateGreen white__hover background-corporateGreen__hover border border-width__2 font-size__6 padding-topbottom__1 margin-top__4 padding-leftright__4 position-float__left"
target="_blank">
<i class="fa fa-chevron-right"></i>
Learn More
</a>
</div>
</div>
<div class="info-block-tile-cell">
<div class="info-block-tile">
<h6 class="margin-top__0 margin-bottom__2 fiord font-weight-sourcesans__bold">Offering 1</h6>
<p class="margin-top__0 margin-bottom__2 fiord font-weight-sourcesans__normal font-size__7">Lorem ipsum dolor
sit amet, ius fastidii similique argumentum in, porro putent consetetur vix ut. Tibique percipitur ex vim,
vim id idque soleat tibique, has te erant doctus complectitur. Nusquam oportere vituperata id cum, adipisci
persecuti an pro. Eu vim facer graecis, id nec dicta integre interpretaris</p>
<a href="http://www.google.com"
class="aligned-bottom text-decoration__none rounded__thick corporateGreen white__hover background-corporateGreen__hover border border-width__2 font-size__6 padding-topbottom__1 margin-top__4 padding-leftright__4 position-float__left"
target="_blank">
<i class="fa fa-chevron-right"></i>
Learn More
</a>
</div>
</div>
</div>
</div>
</div>
codepen鏈接:http://codepen.io/neginbasiri/pen/wWvjba
什麼是你想要的行爲?這些容器是底部對齊的,除非您設置固定的高度和滾動,否則不能有相同的尺寸。你想要它頂部對齊和固定高度滾動嗎? – Ash
我更新了說明。容器必須從頂部和底部對齊,高度相同 –