Javascript 垂直居中相对位置+未知高度
我有两个专栏在我的WP网站。一个具有文本/内容,另一个具有背景图像。两者都相对定位,高度未知 使用twitter的HTML-Bootstrap3标记Javascript 垂直居中相对位置+未知高度,javascript,jquery,html,css,twitter-bootstrap,Javascript,Jquery,Html,Css,Twitter Bootstrap,我有两个专栏在我的WP网站。一个具有文本/内容,另一个具有背景图像。两者都相对定位,高度未知 使用twitter的HTML-Bootstrap3标记 <article> <div id="...removed php code "> <div class="row"> <div class="col-md-8 indx-img" style="background-image:url('...');">
<article>
<div id="...removed php code ">
<div class="row">
<div class="col-md-8 indx-img" style="background-image:url('...');">
</div>
<div class="col-md-4 text-cell">
<h1><?php the_title(); ?></h1>
<h3><?php the_category(' '); ?></h3>
</div>
</div><!-- /row -->
</article>
我希望文本单元格div在其列中垂直居中。列的高度由其相邻的列索引img div设置,并带有填充:15%0
.text-cell {
position: relative;
padding: 0 25px;
margin: x% 0 0;
transform: translateY(y%)
}
或者在jquery中计算行高,然后设置偏移量。jquery中的文本单元格div添加此样式:
.text-cell {
display : flex;
align-self : center;
}
查看flexbox和display:Table它的可能副本是某种类型的副本,虽然我已经更改了代码,但仍然无法解决添加和更改这些值似乎并没有影响我的div
.text-cell {
display : flex;
align-self : center;
}