单行文本溢出居中
想要实现这种,多行溢出默认左对齐 使用flex

.box{
display: flex;
align-items: center;
justify-content: center;
}
假设需求说多行溢出后也要居中对齐 类似这种

只需要在上一段代码中添加text-align:center即可
.box{
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
浙公网安备 33010602011771号