[英]Vertical-align bottom not working in a table-cell
I have a div which is a bootstrap row. 我有一个div,它是一个引导行。 I want to vertically align a to the bottom of the div, however it is still aligned to the top of the row div. 我想将a垂直对齐div的底部,但是仍然将其对齐div的顶部。
Code: 码:
<div class="row" style="height:100%;">
<div class="col-xs-12" style="height:100%;display:table-cell;vertical-align: bottom;">
<h4 style="color:#FFF;vertical-align: bottom;">*Stuff like restaurants, meat alternatives, dairy alternatives, and much more!</h4>
</div>
</div>
Why is this code not working? 为什么此代码不起作用?
Please refer the code: 请参考代码:
<div class="row">
<div class="col-xs-12" style="display:table;">
<h4 style="color:#000; display: table-cell; vertical-align: bottom;">*Stuff like restaurants, meat alternatives, dairy alternatives, and much more!</h4>
</div>
add display:table
to parent div.row
also add body & html Height 100%; 将display:table
添加到父div.row
还添加body和html Height 100%;
<div class="row" style="height:100%; display: table;">
<div class="col-xs-12" style="height:100%;display:table-cell;vertical-align: bottom;">
<h4 style="color:#FFF;vertical-align: bottom;">*Stuff like restaurants, meat alternatives, dairy alternatives, and much more!</h4>
</div>
</div>
https://jsfiddle.net/mjaty6u7/ https://jsfiddle.net/mjaty6u7/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.