我使用旋轉木馬容器創建具有文本一個頁標題爲中心(水平&垂直地),因爲它是居中文本在圖像的最簡單的方法 - 參照圖像。 多行傳送帶標題爲引導
我的客戶要我加一條水平線上方&下面的文字,因爲它低於這個形象做了,但是我不知道在實現這一目標的最佳方式 - 放棄一切仍需要集中&它必須有響應。
這是我的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,我只是建議解決方案。您可以使用偏移量或使用適當的參數擴大列大小 –