bootstrap 在中间垂直对齐内容

bootstrap align vertically content in the middle

如何垂直对齐列中间的内容? 这是我的 jsffidle ,我希望左列中的文本在列的中心垂直对齐 bootstrap有没有特殊的class?

<div class="row">
    <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 ">
        <span class="v-align">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</span>
    </div>
        <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
        <img class="pull-right img-responsive" style="margin-top:10px;"src="http://lorempixel.com/1000/1000" />

    </div>
</div>

使用 <center> 将使文本居中,使用 <div> 标签并将属性 align 设置为 center 将执行相同的操作。如果你想让元素在页面中居中,使用 <table> should work (jsfiddle):

<html>
Lorem Ipsum something something.
<table align="center">
    <tr><td width="20%">Hello</td></tr>
</table>
</html

你可以试试这个:

.row {
    display: table;
}

[class*="col-"] {
    float: none;
    display: table-cell;
    vertical-align: middle;
}

一些 JS 的可能解决方案(响应式布局需要小广告):
https://jsfiddle.net/muzd1prc/

.v-align-container{
 -webkit-transform-style: preserve-3d;
 -moz-transform-style: preserve-3d;
 transform-style: preserve-3d;
}
.v-align{
  position: relative;
  top: 50%;
  -webkit-transform: translateY(-50%);
  -ms-transform: translateY(-50%);
  transform: translateY(-50%);
}

$(document).ready(function() {
    $(".v-align-container img").bind('load', function(event) {
        var $row = $(this).parents(".v-align-container:first");
        $row.height($row.height());            
    });
});

尝试使用这个, 这可行,但我们需要为该跨度指定高度。

就像下面这样:-

<div class="row">
    <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 ">
        <span class="v-align" style="vertical-align: middle; display: table-cell; height: 565px;">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</span>
    </div>
        <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
        <img class="pull-right img-responsive" style="margin-top:10px;" src="http://lorempixel.com/1000/1000" />

    </div>
</div>