我希望我的文本保持居中,我想将它移动到div的右侧。我的div覆盖了图像背景。在div的右侧放置文本
我试图改变:
<div class="col-sm-12">
到:
<div class="col-sm-12" style="float:right;">
,但没有任何效果。有没有办法让我在bootstrap中做到这一点,或者我必须使用我的自定义CSS?这怎么能做到呢?
HTML:
<div id="box" class="vcenter">
<div class="container">
<div class="row center">
<div class="col-md-12">
<div class="row">
<div class="col-sm-12">
<p>Text text text text text text text text text ext text text text text text text text/p>
<p>Text text text text text text text text text ext text text text text text text text/p>
<p>Text text text text text text text text text ext text text text text text text text/p>
</div>
</div>
</div>
</div>
</div>
</div>
CSS:
.vcenter {
display: flex;
align-items: center;
}
#box {
background: url("url here") no-repeat center;
height: 500px;
}
.center {
text-align: center;
}
**文本保持居中**的,我想**它移动到右侧**的div?所以你想要它居中或右对齐? –
以右对齐的div为中心@AndrewLyndem – user4756836