我有一个css网格.我想使用nth-child
、odd
和even
Select 器来使项在网格的每个垂直边缘上推-它应该如下所示:
.questionsAndAnswers {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-gap: 24px;
font-size: 12px;
font-family: "sans-serif";
justify-items: end;
border: 1px solid red;
}
.questionsAndAnswers:nth-child(odd){
justify-items: start;
}
<div class="questionsAndAnswers">
<p>
one
</p>
<p>
two
</p>
<p>
three
</p>
<p>
four
</p>
</div>