CSS實現三列圖片等寬等間距布局

來源:互聯網
上載者:User

每個圖片塊左浮動,寬30%,左外邊距2.5%:
100%=(2.5%+30%)+(2.5%+30%)+(2.5%+30%)+2.5%

     三列圖片等寬布局              

簡單實用的百分比布局 還是很適合手機WAP頁面配置的:

min-width:320px; max-width:420px; width:100%; overflow-x: hidden; margin: 0 auto;

最小寬度320px,最大寬度420px,在320px和420px之間自動適應寬度,看起來還行.
在標籤裡只用設定width屬性百分比值,比如width="40%",不用設定height屬性,這樣圖片能夠自行按原比例縮放.
容器裡面的塊,同樣可以用百分比布局,比如左邊的60%,右邊的40%.

  • 相關文章

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.