Categories: CSS3新文本属性

CSS text-align-last 属性 | CSS3教程:CSS3 文本效果

返回到:CSS3 文本效果 | CSS3教程

定义和用法

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-last47.05.512.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

这个人很懒,什么都没有留下~

Share
Published by
terry

Recent Posts

聊聊vue3中的defineProps

在Vue 3中,defineP…

1 周 ago

在 Chrome 中删除、允许和管理 Cookie

您可以选择删除现有 Cooki…

2 周 ago

自定义指令:聊聊vue中的自定义指令应用法则

今天我们来聊聊vue中的自定义…

3 周 ago

聊聊Vue中@click.stop和@click.prevent

一起来学下聊聊Vue中@cli…

4 周 ago

Nginx 基本操作:启动、停止、重启命令。

我们来学习Nginx基础操作:…

4 周 ago

Vue3:手动清理keep-alive组件缓存的方法

Vue3中手动清理keep-a…

1 月 ago