定义和用法
text-align-last 属性规定如何对齐文本的最后一行。
注意:text-align-last 属性只有在 text-align 属性设置为 “justify” 时才起作用。
默认值: | auto |
---|---|
继承: | 是 |
可动画化: | 否。 |
版本: | CSS3 |
JavaScript 语法: | object.style.textAlignLast=”right” |
CSS 语法
text-align-last: auto|left|right|center|justify|start|end|initial|inherit;
属性值
值 | 描述 |
---|---|
auto | 默认值。最后一行被调整,并向左对齐。 |
left | 最后一行向左对齐。 |
right | 最后一行向右对齐。 |
center | 最后一行居中对齐。 |
justify | 最后一行被调整为两端对齐。 |
start | 最后一行在行开头对齐(如果 text-direction 是从左到右,则向左对齐;如果 text-direction 是从右到左,则向右对齐)。 |
end | 最后一行在行末尾对齐(如果 text-direction 是从左到右,则向右对齐;如果 text-direction 是从右到左,则向左对齐)。 |
initial | 设置该属性为它的默认值。 |
inherit | 从父元素继承该属性。 |
浏览器支持
表格中的数字表示支持该属性的第一个浏览器版本号。
-moz- 后指定的数字为支持该函数的第一个版本号前缀。
属性 | 谷歌 | IE | 火狐 | 苹果 | opera |
---|---|---|---|---|---|
text-align-last | 47.0 | 5.5 | 12.0 -moz- | 不支持 | 34.0 |
实例
把段落的最后一行向右对齐:
<!DOCTYPE html> <html> <head> <title>Web176教程网(web176.com)</title> <style> div { text-align: justify; text-align-last: right; -moz-text-align-last: right; /* 针对 Firefox 的代码 */ } </style> </head> <body> <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. 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> <p><b>注意:</b>只有 Internet Explorer 支持 text-align-last 属性。</p> <p><b>注意:</b>Firefox 支持另一个可替代该属性的属性,即 -moz-text-align-last 属性。</p> </body> </html>
作者:terry,如若转载,请注明出处:https://www.web176.com/css3textpro/5163.html