![](/img/trans.png)
[英]How can I position this fontawesome icon vertically aligned in the middle of the header div in bootstrap
[英]How to vertically aligned to middle with bootstrap?
我正在尝试创建一种布局,以使两个上下箭头堆叠在另一个之上。 当前,箭头水平对齐。 我不确定如何将其与Title
文本一起堆叠并垂直对齐到中间。 我该怎么做呢?
<div class="row">
<div class="col-xs-8">Title</div>
<div class="col-xs-4">
<a href="">
<div class="glyphicon glyphicon-menu-up"></div>
</a>
<a href="">
<div class="glyphicon glyphicon-menu-down"></div>
</a>
</div>
</div>
CSS
.wrapper {
padding:20px;
background-color:green;
color:white;
}
a div {
color:white;
}
https://jsfiddle.net/371yuk1r/2/
非常感谢!
一种不使用bootstrap
类的解决方案是添加display: table-row;
像这样a
元素:
HTML
<div class="row">
<div class="col-xs-8">Title</div>
<div class="col-xs-4">
<a href="" class="arrowVert">
<div class="glyphicon glyphicon-menu-up"></div>
</a>
<a href="">
<div class="glyphicon glyphicon-menu-down"></div>
</a>
</div>
</div>
CSS
.arrowVert {
display: table-row;
}
Bootstrap中有一些帮助程序类,您可以将其用于代码。 请查看以下链接: http : //getbootstrap.com/css/#helper-classes-center
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/> <div class="row"> <div class="col-xs-8">Title</div> <div class="col-xs-4"> <a href="#"> <div class="glyphicon glyphicon-menu-up"></div> </a> <div class="clearfix"></div> <a href="#"> <div class="glyphicon glyphicon-menu-down"></div> </a> </div> </div>
你想要这样吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.