我想以文字中心覆盖图像为中心。这里是我的代码是什么:以中心为中心覆盖图像的文字
<div class="col-md-6">
<div class="safaripreview">
<img src="img/safari1.png" class="img-responsive" alt="">
<h3>Our String Of Pearls</h3>
</div>
</div>
和我的CSS是目前
.safaripreview
{
position: relative;
}
.safaripreview h3
{
position: absolute;
bottom: 0;
width: 100%;
color: white;
padding: 10px;
font-family: 'Montserrat', sans-serif;
font-weight: 700;
}
本步骤是:
当我想要实现这个
有没有更好的方法来实现这个目标? Flexbox的?
你可以使用图片作为背景,这样你就不需要文本的绝对位置。 –