答案 0 :(得分:0)
尝试使用此:
div {
display: flex;
justify-content: space-between;
}
.first-row>p:first-child {
color: red;
}
.first-row>p:last-child {
color: green;
}
<div class="first-row">
<p>first</p>
<p>second</p>
<p>third</p>
</div>
<div class="second-row">
<p>first</p>
<p>second</p>
<p>third</p>
</div>
在这里,我以<p>
为孩子。如果愿意,可以将div
作为孩子,然后确保从div移除flex并应用于first-row
和second-row
而不是div
标签。并将first-row>p
更改为first-row>div