I have the code below, it's working perfectly, the only problem is that if I add one more or a few li it changes its formatting. I wish it would stay the same now, except regardless of how many LIs exist. I would like the background to be the same as the one in the example, but always regardless of the amount of li, in case you want to test, just increase the li and you will see that the black background will change position.
ul {
margin-top: 30px;
width: 100%;
float: left;
}
li {
width: 50%;
float: left;
cursor: pointer;
}
li:nth-last-of-type(4n+1) {
color: #fff;
background: #000;
}
li:nth-last-of-type(4n+2) {
color: #fff;
background: #000;
}
<ul>
<li class="col-md-6 col-sm-6 col-xs-12" <h2>Caixa Econômica1</h2>
</li>
<li class="col-md-6 col-sm-6 col-xs-12" <h2>Caixa Econômica2</h2>
</li>
<li class="col-md-6 col-sm-6 col-xs-12" <h2>Caixa Econômica3</h2>
</li>
<li class="col-md-6 col-sm-6 col-xs-12" <h2>Caixa Econômica4</h2>
</li>
<li class="col-md-6 col-sm-6 col-xs-12" <h2>Caixa Econômica5</h2>
</li>
<li class="col-md-6 col-sm-6 col-xs-12" <h2>Caixa Econômica6</h2>
</li>
<li class="col-md-6 col-sm-6 col-xs-12" <h2>Caixa Econômica</h2>
</li>
<li class="col-md-6 col-sm-6 col-xs-12" <h2>Caixa Econômica</h2>
</li>
<li class="col-md-6 col-sm-6 col-xs-12" <h2>Caixa Econômica</h2>
</li>
<li class="col-md-6 col-sm-6 col-xs-12" <h2>Caixa Econômica</h2>
</li>
<li class="col-md-6 col-sm-6 col-xs-12" <h2>Caixa Econômica</h2>
</li>
<li class="col-md-6 col-sm-6 col-xs-12" <h2>Caixa Econômica</h2>
</li>
<li class="col-md-6 col-sm-6 col-xs-12" <h2>Caixa Econômica</h2>
</li>
<li class="col-md-6 col-sm-6 col-xs-12" <h2>Caixa Econômica</h2>
</li>
<li class="col-md-6 col-sm-6 col-xs-12" <h2>Caixa Econômica</h2>
</li>
<li class="col-md-6 col-sm-6 col-xs-12" <h2>Caixa Econômica</h2>
</li>
</ul>