sass - css grid with nth-child -


is possible create repeating pattern of uneven columns using nth-child? have, works first row:

.three-cols > div:nth-child(1n) {    width: 50%; } .three-cols > div:nth-child(2n) {   width: 25%;  }  .three-cols > div:nth-child(3n) {   width: 25%;  }  .three-cols > div:nth-child(3n) {  margin-right: 0;  } 

so want every row split:50%,25%,25%

http://codepen.io/garethj/pen/knpqyd

there 3 items per row need use 3n each selector. offset 1, 2 or 3 depending on element wish target:

.three-cols > div:nth-child(3n+1) {    width: 50%;  }  .three-cols > div:nth-child(3n+2) {    width: 25%;  }  .three-cols > div:nth-child(3n+3) {    width: 25%;  }  .three-cols > div:nth-child(3n+3) {    margin-right: 0;  }  .block {    overflow: hidden;  }  .block > div {    box-sizing: border-box;    float: left;    border: 3px solid purple;  }
<footer>    <div class="block three-cols">        <div>50%</div>      <div>25%</div>      <div>25%</div>        <div>50%</div>      <div>25%</div>      <div>25%</div>        <div>50%</div>      <div>25%</div>      <div>25%</div>      </div>  </footer>


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -