p标签:在网页设计中,我们常常会用到两端对齐的布局方式。不过,当最后一行的内容不足以填满整行时,两端对齐的效果就不太好了。这时候,我们需要对最后一行进行特殊处理,使其看起来更加美观。pre标签:.st...
p标签:在网页设计中,我们常常会用到两端对齐的布局方式。不过,当最后一行的内容不足以填满整行时,两端对齐的效果就不太好了。这时候,我们需要对最后一行进行特殊处理,使其看起来更加美观。
pre标签:
.stretched-last {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.stretched-last::before {
content: ';
flex: auto;
}
.stretched-last::after {
content: ';
flex: auto;
} <div class="stretched-last">
<p>这是一段文字,</p>
<p>这是第二段文字,</p>
<p>这是第三段文字,</p>
<p>这是最后一行。</p>
</div> .stretched-last {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.stretched-last::before {
content: ';
flex: auto;
}
.stretched-last::after {
content: ';
flex: auto;
}