Trying to do as shown in the picture. The number M is the same in all cases and is intended as a percentage. I am a beginner, so I believe that I’m missing the well-known formula that counts this number in two accounts. If there are other options for solving this problem, I will be glad to read it.
Approximate code turned out below. That's just instead of 4% in
.box-M { width: 4%; } should be the number M. Thanks in advance!
.box { width: 100%; height: 44px; } .box div{ float: left; height: 44px; } .box div:nth-child(even) { background-color: red; width: 44px; } .box div:nth-child(odd) { background-color: black; } .box div:first-child, .box div:last-child { width: 7.5%; } .box-M { width: 4%; } </style> <div class="box"> <div></div> <div></div> <div class="box-M"></div> <div></div> <div class="box-M"></div> <div></div> <div class="box-M"></div> <div></div> <div class="box-M"></div> <div></div> <div></div> </div> 