我使用旋转木马容器创建具有文本一个页标题为中心(水平&垂直地),因为它是居中文本在图像的最简单的方法 - 参照图像。 多行传送带标题为引导
我的客户要我加一条水平线上方&下面的文字,因为它低于这个形象做了,但是我不知道在实现这一目标的最佳方式 - 放弃一切仍需要集中&它必须有响应。
这是我的HTML代码(不包括Navbar,作为它的Bootstrap);
<div class="container">
<div id="mycarousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="item active">
<img src="images/community-group.jpg" alt="" class="center-block img-responsive" style="opacity: 0.8;">
<div class="carousel-caption">
<div class="text-center full-width"><h1>Contact Us </h1></div>
</div>
</div>
</div>
</div>
</div>
下面是用于处理旋转木马&旋转木马标题,并确保他们为中心的当前CSS:
.full-width {
width: 100%;
}
h1 {
color: #ffffff;
font-size: 400%;
text-shadow: 2px 2px #9e9e9e;
}
.carousel-caption {
position: absolute;
top: 0;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-box-align: center;
-moz-box-align: center;
-ms-flex-align: center;
-webkit-align-items: center;
align-items: center;
height: 100%;
vertical-align: middle;
}
这几乎工程@Deepakswain使用,虽然山口-SM4不是一个足够宽的列+公司不再集中在图像。 〜我猜以及COL-SM-4是不够大,因为这些列在容器内,与不完整的屏幕宽度。 – BlissSol
@BlissSol,我只是建议解决方案。您可以使用偏移量或使用适当的参数扩大列大小 –