所以我很难把一个按钮排列在我的Bulma栏的底部,我想把 "购买 "按钮放在右栏的底部(与 "你好 "按钮并排)。
我希望 "购买 "按钮位于右栏的底部(与 "你好 "按钮并排)。我之所以会出现这种情况,是因为我的其他列的内容比较长,我想把 "购买 "按钮放在右列的底部(与 "你好 "按钮并排)。
到目前为止,我尝试了这些CSS样式在我的按钮上(他们都没有帮助我)。
vertical-align: bottom;
margin-bottom: auto;
position: absolute;
bottom: 0;
这是我的HTML。
<section class="section">
<div class="columns is-centered">
<div class="column is-one-fifth">
<h4 class="title is-4">I'm a big column</h4>
I'm taller than the column next to me so my column will be bigger, lorem ipsum lorem ipsum lorem ipsum lorem ipsum
<h6 class="sub">"lorem ipsum"</h6>
<button class="button is-fullwidth">Hello</button>
</div>
<div class="column is-one-fifth">
<h4 class="title is-4">I'm a small column</h4>
I'm a small column, and my button missplaced
<h6 class="sub">"lorem ipsum"</h6>
<button class="button is-fullwidth">BUY</button>
</div>
</div>
</section>
你们能帮帮我吗?
希望它是你工作的答案。
.maindiv{
width:200px;
height:180px;
border:1px solid red;
display:flex;
flex-direction:column;
align-items:center;
justify-content:space-between
}
.innerdiv{
display:flex;
flex-direction:column;
}
button{
width:150px;
height:30px;
color:white;
background-color:blue;
border-radius:4px
}
<div class='maindiv'>
<h3>Mana Foutan</h3>
<span>lorem ipsum lorem ispum</span>
<div class='innerdiv'>
<i>Make it rain!</i>
<button>Buy</button>
</div>
</div>
好吧,foud的答案。Bulma列需要有一些属性(由@ahsan-ullah建议)。然后按钮需要有一个自动边距到顶部。
<section class="section">
<div class="columns is-centered">
<div class="column is-one-fifth item">
<h4 class="title is-4">I'm a big column</h4>
I'm taller than the column next to me so my button will be higher,lorem ipsum lorem ipsum lorem ipsum lorem ipsum
<h6 class="sub">"lorem ipsum"</h6>
<button class="button is-fullwidth">Hello</button>
</div>
<div class="column is-one-fifth item">
<h4 class="title is-4" style="align-self: flex-start;">I'm a small column</h4>
I'm a small column, and my button is well placed
<h6 class="sub">"lorem ipsum"</h6>
<button class="button is-fullwidth">BUY</button>
</div>
</div>
</section>
.item{
display:flex;
flex-direction:column;
justify-content:space-between
}
.columns button{
margin-top: auto;
}
结果是: