[英]Align div vertically center
As the title says, i have a div that i want to align center vertically. 如标题所示,我有一个div,我想垂直居中对齐。
<body>
<div class="container" id="names_wrapper">
<div class="row">
<div class="col-md-4">
<a href="#">
<img src="images/feat1" class="img-responsive img-circle">
<h2 class="text-center">Jammu</h2>
</a>
</div>
<div class="col-md-4">
<a href="#">
<img src="images/feat2" class="img-responsive img-circle">
<h2 class="text-center">Kashmir</h2>
</a>
</div>
<div class="col-md-4">
<a href="#">
<img src="images/feat3" class="img-responsive img-circle">
<h2 class="text-center">Ladakh</h2>
</a>
</div>
</div>
</div>
</body>
i tried to wrap that div in a another div with height of 100%
and applied vertical-align: center
property but it doesn't work. 我试图将该div包装到另一个高度为100%
div中,并应用了vertical-align: center
属性,但是它不起作用。
i'm using twitter bootstrap. 我正在使用Twitter Bootstrap。 Whats' the solution? 有什么解决方案?
Assuming that you are trying to center the .row
div inside the .container
假设您试图将.row
div放在.container
内部
.container {
display:table-cell;
vertical-align:middle;
}
Hope it will help 希望对你有帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.