语法
text-justify: auto | inter-word | inter-character | none | initial | inherit;
text-justify 属性的示例:
<!DOCTYPE html>
<html>
<head>
<title>文档的标题</title>
<style>
div {
text-align: justify;
text-justify: auto;
}
</style>
</head>
<body>
<h2>Text-justify 属性示例</h2>
<div>
经历过风雨,才懂得阳光的温暖。 今天很残酷,明天很残酷,后天很美好。很多人死在了明天的夜里。
经历过风雨,才懂得阳光的温暖。今天很残酷,明天很残酷,后天很美好。很多人死在了明天的夜里。
经历过风雨,才懂得阳光的温暖。
</div>
</body>
</html>
在以下示例中,调整浏览器的大小以查看“justify”是如何工作的:
具有“字符间”值的 text-justify 属性示例:
<!DOCTYPE html>
<html>
<head>
<title>文档的标题</title>
<style>
div {
text-align: justify;
text-justify: inter-character;
}
</style>
</head>
<body>
<h2>Text-justify 属性示例</h2>
<div>
经历过风雨,才懂得阳光的温暖。今天很残酷,明天很残酷,后天很美好。很多人死在了明天的夜里。
经历过风雨,才懂得阳光的温暖。今天很残酷,明天很残酷,后天很美好。很多人死在了明天的夜里。
经历过风雨,才懂得阳光的温暖。
</div>
</body>
</html>
text-justify 属性定义了单词或者字符之间的间距行为。
text-justify 属性是 CSS3 属性之一。
text-justify 属性选择 text-align 设置为“justify”时文本的对齐方式。
| 初始值 | auto |
|---|---|
| 应用于 | 内联级和表格单元元素。 |
| 继承 | 可继承 |
| 可动画的 | 不 |
| 版本 | CSS3. |
| DOM 语法 | object.style.textjustify =“conter-character”; |
CSS text-justify 属性值说明
| 值 | 描述 |
|---|---|
| auto | 定义了公正算法。允许浏览器确定单词互换或者性能是否更好。这是此属性的默认值。 |
| inter-character | 浏览器会增加字符之间的空间。该值是一系列字母间距属性。 |
| none | 理由被停用。 |
| distribute | 具有与单词相同的功能。该值保存为向后兼容性。 |
| initial | 使属性使用其默认值。 |
| inherit | 从父母元素继承属性。 |
日期:2020-06-02 22:14:48 来源:oir作者:oir
