【发布时间】:2015-06-09 20:30:04
【问题描述】:
我正在做一个引导项目,我需要一个文本和图像,看起来类似于之前在链接下提出的问题:
How to vertically align both image and text in a DIV using CSS?
另外,我有一个固定高度为 550 像素的背景横幅。 我正在尝试使用引导程序创建它,并且还尝试使用 Display: table , display: table-cell, vertical-align: middle;属性,但如果不使用将 height:550px 放在包含文本和图像的两个 div 上,我似乎无法正确处理。
.overview-banner {
background: url(../img/overview/overview-bg.jpg) no-repeat center center;
background-size: cover;
height: 550px;
.display-table{
display: table;
}
.verticle-center{
display: table-cell;
vertical-align: middle;
}
<section class="overview-banner">
<div class="container-fluid">
<div class="col-md-6 col-sm-6 col-xs-12">
<div class="display-table" style="height:550px;">
<div class="verticle-center" style="height:100%">
<h1>The Multi-Faceted Simpuite</h1>
</div>
</div>
</div>
<div class="col-md-6 col-sm-6 col-xs-12">
<div class="display-table" style="height:550px;">
<div class="verticle-center" style="height:100%">
<img src="{{ STATIC }}assets/img/overview/overview-banner.png" alt="Multi Faceted Simpuite" class="img-responsive img-center-xs">
</div>
</div>
</div>
</div>
</section>
我想在编码中不使用太多高度的情况下得到结果。
另外,我希望它出现在移动设备中时能够响应。
请告知是否有任何其他方式可以进行引导,它可以响应并根据横幅高度 550 像素居中文本和图像,并且不需要经常提及高度。
【问题讨论】:
-
图片在哪里发布并附上实际图片的链接。
标签: html css twitter-bootstrap