0
I’m trying to do in CSS3 with Nth-Child() the famous "color yes, color no" in a list made in Foundation 5. It happens that in the middle of the list there will be a div in which will be a modal and this modal div ends up messing up the effect "color yes, color no" making the column turn gray, instead of the line.
#container>.row div:nth-child(2n) {
background-color: #dcdcdc;
}
#container>.row div:nth-child(2n+1) {
background-color: #fff;
}
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.3.1/css/foundation.min.css">
<div id="container">
<div class="row listPedidos">
<div class="small-3 columns">
a
</div>
<div class="small-3 columns">
b
</div>
<div class="small-3 columns">
c
</div>
<div class="small-3 columns">
d
</div>
</div>
<div>
<!-- essa div é essencial. Ela será um modal contendo infos -->
</div>
<div class="row">
<div class="small-3 columns">
a
</div>
<div class="small-3 columns">
b
</div>
<div class="small-3 columns">
c
</div>
<div class="small-3 columns">
d
</div>
</div>
<div>
<!-- essa div é essencial. Ela será um modal contendo infos -->
</div>
<div class="row">
<div class="small-3 columns">
a
</div>
<div class="small-3 columns">
b
</div>
<div class="small-3 columns">
c
</div>
<div class="small-3 columns">
d
</div>
</div>
<div>
<!-- essa div é essencial. Ela será um modal contendo infos -->
</div>
<div class="row">
<div class="small-3 columns">
a
</div>
<div class="small-3 columns">
b
</div>
<div class="small-3 columns">
c
</div>
<div class="small-3 columns">
d
</div>
</div>
<div>
<!-- essa div é essencial. Ela será um modal contendo infos -->
</div>
<div class="row">
<div class="small-3 columns">
a
</div>
<div class="small-3 columns">
b
</div>
<div class="small-3 columns">
c
</div>
<div class="small-3 columns">
d
</div>
</div>
<div>
<!-- essa div é essencial. Ela será um modal contendo infos -->
</div>
<div class="row">
<div class="small-3 columns">
a
</div>
<div class="small-3 columns">
b
</div>
<div class="small-3 columns">
c
</div>
<div class="small-3 columns">
d
</div>
</div>
<div>
<!-- essa div é essencial. Ela será um modal contendo infos -->
</div>
</div>
:nth-child(number) {
 css declarations;
}
.... you’re passingdiv:nth-child(2n)
.. what is that"n"
?– Don't Panic
I can’t really explain what the
n
, but it is a kind of multiplier. It works similar to:nth-child(odd)
and the:nth-child(even)
– Bruno Folle