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