如何在CSS中居中对齐文本的最后一行? [英] How to center-justify the last line of text in CSS?
本文介绍了如何在CSS中居中对齐文本的最后一行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何对文本进行居中对齐?
How can I center-justify text?
当前,justify不在最后一行居中.
Currently, justify does not center the last line.
推荐答案
You can use the text-align-last
property
.center-justified {
text-align: justify;
text-align-last: center;
}
以下是兼容性表: https://developer.mozilla.org/zh-CN/docs/Web/CSS/text-align-last#Browser_compatibility .
可在除Safari(Mac和iOS)(包括Internet Explorer)以外的所有浏览器中使用.
Works in all browsers except for Safari (both Mac and iOS), including Internet Explorer.
此外,在Internet Explorer中,仅与text-align: justify
(不包含text-align
的其他值)一起使用,并且不支持start
和end
.
Also in Internet Explorer, only works with text-align: justify
(no other values of text-align
) and start
and end
are not supported.
这篇关于如何在CSS中居中对齐文本的最后一行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文