text-align-last

text-align-last 属性规定如何对齐最后一行或紧挨着强制换行符之前的行。

 

语法

text-align-last: auto|left|right|center|justify|start|end|initial|inherit;

描述
auto默认值。最后一行被调整,并向左对齐。
left最后一行向左对齐。
right最后一行向右对齐。
center最后一行被调整为两端对齐。
justify最后一行在行开头对齐(如果 text-direction 是从左到右,则向左对齐;如果 text-direction 是从右到左,则向右对齐)。
end最后一行在行末尾对齐(如果 text-direction 是从左到右,则向右对齐;如果 text-direction 是从右到左,则向左对齐)。
initial设置该属性为它的默认值。
inherit从父元素继承该属性。

例子

HTML

<div>
You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to   justify. This text is where you will see the result of the  text-align-last property. You can use the text-align-last property   to align the last line of a text, if the text has the text-align property set to justify. This text is where you will see the   result of the  text-align-last property.
You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to justify. This text is where you will see the result of the  text-align-last property.
You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to   justify. This text is where you will see the result of the  text-align-last property.
</div>

CSS

div
{
text-align: justify;
text-align-last: right;
-webkit-text-align-last: right;
-ms-text-align-last: right;
-moz-text-align-last: right;
-o-text-align-last: right;
}

执行结果

You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to justify. This text is where you will see the result of the text-align-last property. You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to justify. This text is where you will see the result of the text-align-last property. You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to justify. This text is where you will see the result of the text-align-last property. You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to justify. This text is where you will see the result of the text-align-last property.

注意:只有 Internet Explorer 支持 text-align-last 属性。

注意:Firefox 支持另一个可替代该属性的属性,即 -moz-text-align-last 属性。

参考

相关链接

外部链接