RS SD RS SD - 20 days ago 5
CSS Question

How to move each box to the right, or to each first box does not move, but it remains the same

How to move each box to the right, or to each first box does not move, but it remains the same.
All red marked boxes to move to the right by 5 pixels, and each blue to remain in the same place.
So I wish that each box in the first row remains in place, without having to move to the right

https://s11.postimg.org/lyh9uaxwj/dsada.png



#istaknuti_proizvodi_box_prikaza {
width:100%;
height:auto;
position: relative;
background: #ccc;
top:75.1px;
}
#istaknuti_proizvodi_prikaz {
width:236px;
height:250px;
border:1px solid #000;
position: relative;
box-sizing: border-box;
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
float:left;
margin-top:2px;
}
#istaknuti_proizvodi_prikaz:nth-child(n+2){
margin-left:5px;
}

<div id="istaknuti_proizvodi_box_prikaza">
<div id="istaknuti_proizvodi_prikaz"></div>
<div id="istaknuti_proizvodi_prikaz"></div>
<div id="istaknuti_proizvodi_prikaz"></div>
<div id="istaknuti_proizvodi_prikaz"></div>
<div id="istaknuti_proizvodi_prikaz"></div>
<div id="istaknuti_proizvodi_prikaz"></div>
<div id="istaknuti_proizvodi_prikaz"></div>
<div id="istaknuti_proizvodi_prikaz"></div>
<div id="istaknuti_proizvodi_prikaz"></div>
<div id="istaknuti_proizvodi_prikaz"></div>
<div id="istaknuti_proizvodi_prikaz"></div>
<div id="istaknuti_proizvodi_prikaz"></div>
</div>




Answer

You can not determine which one will come left. As by assuming 4 boxes fits your parent i have added the fiddle.

You can add min-width constrains to change it as the left most box changes. Likr 3n+1 for less width

Comments