Twitter bootstrap 使用flexbox在Bootstrap3转盘中垂直居中放置内容
我试图将h3和p元素集中在一个div中,更准确地说是Bootstrap的.carousel标题。我已经给出了固定高度和宽度的旋转木马标题。我试图将h3和p垂直对齐到ID父div的中心,如下所示:Twitter bootstrap 使用flexbox在Bootstrap3转盘中垂直居中放置内容,twitter-bootstrap,flexbox,Twitter Bootstrap,Flexbox,我试图将h3和p元素集中在一个div中,更准确地说是Bootstrap的.carousel标题。我已经给出了固定高度和宽度的旋转木马标题。我试图将h3和p垂直对齐到ID父div的中心,如下所示: ––––––––––––––––––––––––––––––––––––––––––––––– |.carousel-caption | |
–––––––––––––––––––––––––––––––––––––––––––––––
|.carousel-caption |
| |
| |
| –––––––––––––––––––––––––––––––––––––––––– |
| |h3 | |
| –––––––––––––––––––––––––––––––––––––––––– |
| –––––––––––––––––––––––––––––––––––––––––– |
| |p | |
| | | |
| –––––––––––––––––––––––––––––––––––––––––– |
| |
| |
| |
–––––––––––––––––––––––––––––––––––––––––––––––
我在这把小提琴的代码,至少与铬,但我试图实现浏览器支持的桌面C28+FF22+S6 IE10和移动支持的iOs 6+safari和安卓4.0+铬
有什么建议吗?得到了一个提示来检查这一点,结果发现解决方案实际上非常简单
标题lorem ipsum dolor
故事发生在今天,它的表现是如此之好,它是如此之好,它是如此之好,它是如此之好,它是如此之好,它是如此之好,它是如此之好
你救了我一天。为此干杯!很好的解决方案。但是,您的代码需要CSS部分的旋转木马标题的高度值。在正常情况下,此高度值与背景图像的高度值相同。检查此代码。
<div class="carousel-caption flex" style="display: flex; align-items: center;">
<div> <!-- div which content is not aligned -->
<h3>Headline lorem ipsum dolor</h3>
<p>Story gnis dis dolor re niet, sed quia se perferciaes eossedit, susam, sam voluptas sandebi stiusam, cuptaturem sequis imi, is etur</p>
</div>
</div>