我有一個網站/頁面,http://watershedgeo.staging.wpengine.com/hydroturf/,我試圖浮動2個圖像留在一個div和他們每個有一個小文本塊需要在底下。每個圖像一個塊。CSS,浮動2個圖像在每個與各自的文本在下面
問題是我的圖像在頂部和底部對齊,但下面的文本是當前偏移的方式。
下面是代碼對它們:
<div>
<div class="container1" style="float: left;"><img style="float: left;" src="/HydroTur-CS_illustration-01152104.jpg" /></div>
<div style="float: left;"><span style="color: #0079ac; font-weight: bold;">HydroTurf CS</span>
HydroTurf CS is typically used for high velocity conditions and for protection of critical structures.</div>
<div>
<div class="container2" style="float: left;">
<div><img style="float: left;" src="/HydroTurfZ_illustration-01152014.jpg" /></div>
<div style="float: left;">"<span style="color: #0093d0; font-weight: bold;">HydroTurf Z</span>
HydroTurf Z is ideal for less critical applications involving lower velocities and flow conditions</div>
</div>
</div>
</div>
你需要在一個容器來包裝形象和相關的文字一起,然後你就可以浮在容器內。 – FluffyKitten
@FluffyKitten謝謝,但即使這讓我在正確的方向,圖像/文本組合現在是在另一個之上,但我需要在左邊image1/text1和在右邊image2/text2。我更新了當前顯示的代碼,雖然 –
浮動左邊,向右浮動? – Icewine