我目前有一些左对齐的文字,但其中心如下:
<div class="center-text">There is some text here</div>
<div class="center-text">There is also some other text here</div>
<div class="center-text">Finally there is some text here</div>
.center-text {
width: 50%;
margin: auto;
}
如何将图像浮动到右下角文本的左侧?我正在寻找的是:
黑框是周围的div,红色是图像,文字如上所述。我的文本目前正如预期的那样表现,但我似乎无法在不影响文本的情况下添加图像。
答案 0 :(得分:0)
我做了一点点不同:
.container{
height: 300px;
position:relative;
border: 30px solid black;
}
.center-text {
width: 100%;
}
p {
margin: 0;
}
img{
position: absolute;
bottom: 0;
left: 0;
width:30%;
}
.text{
float: right;
width: 65%;
margin-top: 100px;
}
&#13;
<div class="container">
<div class="center-text">
<img src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcRLwIM4lLwdmXvvYio988Z70kxTBtoNudITd9_72iGRjlusoVey" />
<div class="text">
<p>There is some text here</p>
<p>There is also some other text here</p>
<p>Finally there is some text here</p>
<p>Finally there is some text here</p>
<p>Finally there is some text here</p>
</div>
</div>
</div>
&#13;
我希望它也可以帮助你:)