【发布时间】:2016-12-14 15:44:50
【问题描述】:
我使用 Carousel Container 创建了一个页面标题,其中文本居中(水平和垂直),因为这是将文本居中放置在图像上的最简单方法 - 参考图像。
我的客户希望我在文本上方和下方添加一条水平线,如下图所示,但我不确定实现这一点的最佳方法 - 鉴于所有内容仍需要居中且必须居中反应灵敏。
这是我的 HTML 代码(不包括导航栏,作为它的引导程序);
<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>
这是用于处理 Carousel 和 Carousel Caption 并确保它们居中的当前 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;
}
【问题讨论】:
标签: html css twitter-bootstrap-3 carousel