2017-02-20 107 views
0

我剛開始學習編碼,並決定使用squarespacewww.rociodelfa.com來設計我的網站。避免圖像在手機上堆疊

我的主要問題是,在我的靈感頁面我有一個需要遵循連貫順序的圖像庫,並且我想修復每行圖像的數量,但對於每一行都不相同。

在移動設備上打開時,圖像被堆疊。我該如何改變它?

+1

當你有移動第一網站,圖像時屏幕的寬度減小疊加。如果你可以添加一個codepen或小提琴,那麼我們可能會幫助你。 – Aslam

回答

0

檢查我附加的代碼。

* { 
 
    box-sizing: border-box; 
 
} 
 

 
.wrapper { 
 
    width: 20%; /* Let's assume you want 5 pictures in a row, so 100%/5 = 20% */ 
 
    float: left; 
 
    padding: 10px; 
 

 
    } 
 
.wrapper img { 
 
    width: 100%; 
 
}
<div class="wrapper"> 
 
    <img src="http://placehold.it/300x300"> 
 
</div> 
 
<div class="wrapper"> 
 
    <img src="http://placehold.it/300x300"> 
 
</div> 
 
<div class="wrapper"> 
 
    <img src="http://placehold.it/300x300"> 
 
</div> 
 
<div class="wrapper"> 
 
    <img src="http://placehold.it/300x300"> 
 
</div> 
 
<div class="wrapper"> 
 
    <img src="http://placehold.it/300x300"> 
 
</div> 
 
<div class="wrapper"> 
 
    <img src="http://placehold.it/300x300"> 
 
</div> 
 
<div class="wrapper"> 
 
    <img src="http://placehold.it/300x300"> 
 
</div> 
 
<div class="wrapper"> 
 
    <img src="http://placehold.it/300x300"> 
 
</div> 
 
<div class="wrapper"> 
 
    <img src="http://placehold.it/300x300"> 
 
</div> 
 
<div class="wrapper"> 
 
    <img src="http://placehold.it/300x300"> 
 
</div>