爲什麼浮動元件沒有正確安排?我的圖片有一些空白區域,我不知道它來自哪裏。如何在HTML/CSS中完成此佈局?
所需的外觀:
代碼:
.inner-wrapper { float: left; width: 100%; color: #000; }
.feature-1 { float: right; margin: 0 auto; width: 50%; height: auto; }
.aside-image-1 { float: left; margin: 0 auto; height: auto; width: 50%; }
.feature-2 { float: left; margin: 0 auto; width: 50%; height: auto; }
.aside-image-2 { float: right; margin: 0 auto; height: auto; width: 50%; }
.feature-3 { float: right; margin: 0 auto; width: 50%; height: auto; }
.aside-image-3 { float: left; margin: 0 auto; height: auto; width: 50%; clear: both; }
<section class="inner-wrapper">
<aside class="aside-image-1">
<img src="https://s13.postimg.org/xsvgi16hv/feature_1.jpg" title="someText" alt="someText">
</aside>
<article class="feature-1">
<h3>In-Store Interactive Tablet</h3>
<p>Shoppers can use Sellr's Help Me Choose feature to</p>
</article>
</section>
<section class="inner-wrapper">
<aside class="aside-image-2">
<img src="https://s13.postimg.org/t89a33msj/feature_2.jpg" title="someText" alt="someText">
</aside>
<article class="feature-2">
<h3>In-Store Interactive Tablet</h3>
<p>Shoppers can use Sellr's Help Me Choose feature to</p>
</article>
</section>
<section class="inner-wrapper">
<aside class="aside-image-3">
<img src="https://s13.postimg.org/9ex6ae9er/feature_3.jpg" title="someText" alt="someText">
</aside>
<article class="feature-3">
<h3>In-Store Interactive Tablet</h3>
<p>Shoppers can use Sellr's Help Me Choose feature to</p>
</article>
</section>
有時直列IMG公司將不得不在它們下面的小空白。通過使它們成爲'display:block'來刪除它。 – mch