1
如何让第一个div(包含文本)不推送图像? 与第二种情况一样,如果文字较长,它会将我的图像推向右侧。使第一个div不能推下一个
我提到带文本的div左边浮动,并有一些左右填充。
此外,我无法漂浮的图像正确。
任何想法?
这是代码:
.text box {
float: left;
padding-right: 100px;
padding-left: 100px;
}
div#firstimagediv,
div#secondimagediv {
width: 657px;
height: 225px;
max-width: 100%;
max-height: 100%;
overflow: hidden;
margin-left: 50px;
}
div#firstimagediv figure {
background-image: url(https://placeholder.pics/svg/200.jpg);
background-size: cover;
position: relative;
font-size: 0;
width: 100%;
height: 100%;
margin: 0;
}
div#secondimagediv figure {
background-image: url(https://placeholder.pics/svg/200.jpg);
background-size: cover;
position: relative;
font-size: 0;
width: 100%;
height: 100%;
margin: 0;
}
<div class="text box">
<h1>Text</h1>
<p>ParagraphParagraphParagraphParagraph</p>
<p>Paragraph</p>
<p>Paragraph</p>
<p>Paragraph</p>
<p>Paragraph</p>
</div>
<div id="firstimagediv">
<figure>
<div id="firstimage"></div>
</figure>
</div>
<div class="text box">
<h1>Longer Text</h1>
<p>ParagraphParagraphParagraphParagraph</p>
<p>Paragraph</p>
<p>Paragraph</p>
<p>Paragraph</p>
<p>Paragraph</p>
</div>
<div id="secondimagediv">
<figure>
<div id="secondimage"></div>
</figure>
</div>
安置自己的代码,以便我们将得到的想法你做了什么错? – Debabrata
@Debabrata ...它的补充,谢谢 – Adrian
所以基本上你想包装文本里面的div?我的意思是如果一条长线来,然后你想分成多行 – Debabrata