CSS参考手册
文本 | Text
文本对齐 | text-justify
该text-justify
CSS属性定义当文本设定为justified时,应该应用什么类型的对齐方式(即,有如下设定:text-align: justify;
时)。
text-justify: none;
text-justify: auto;
text-justify: inter-word;
text-justify: inter-character;
text-justify: distribute; /* Deprecated value */
Initial value |
auto |
---|---|
Applies to |
inline-level and table-cell elements |
Inherited |
yes |
Media |
visual |
Computed value |
as specified |
Animation type |
discrete |
Canonical order |
the unique non-ambiguous order defined by the formal grammar |
语法
该text-justify
属性被指定为下面的列表中的任意一个关键字。
可能的值
none
——文本对齐关闭。这与完全没有设置text-align
的效果相同,但是如果由于某种原因需要打开和关闭对齐功能时,该设定就很有用了。
auto
——浏览器根据性能和质量之间的平衡,选择适合当前情况的最佳类型,并且要求最适合当前文本语言(例如,英语,中日韩语言等)。如果text-justify
没有设置,则这是默认的对齐方式。
inter-word
——通过在单词之间添加空格(适时改变word-spacing
)来使文本分布最为合适,这对于使用空格(例如英语或韩语)分隔单词的语言是最合适的。
inter-character
——通过在字符之间添加空格来有效地改变文本是合理的(适时改变letter-spacing
),这对日语等语言来说是最合适的。
distribute
——表现与inter-word
相同,该值为保持向后兼容性而保留。
形式语法
auto | inter-character | inter-word | none
实例
p {
font-size: 1.5em;
border: 1px solid black;
padding: 10px;
width: 95%;
margin: 10px auto;
text-align: justify;
}
.none {
text-justify: none;
}
.auto {
text-justify: auto;
}
.dist {
text-justify: distribute;
}
.word {
text-justify: inter-word;
}
.char {
text-justify: inter-character;
}
规范
Specification |
Status |
Comment |
---|---|---|
CSS Text Module Level 3The definition of 'text-justify' in that specification. |
Working Draft |
|
浏览器兼容性
Feature |
Chrome |
Edge |
Firefox (Gecko) |
Internet Explorer |
Opera |
Safari |
---|---|---|---|---|---|---|
Basic support |
No support2 |
141 |
55.0 (55.0) |
111 |
No support2 |
No support |
Feature |
Android |
Chrome for Android |
Edge |
Firefox Mobile (Gecko) |
IE Mobile |
Opera Mobile |
Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support |
No support2 |
No support2 |
141 |
55.0 (55.0) |
111 |
No support2 |
No support |
文本 | Text相关
层叠样式表( Cascading Style Sheets )是一种用来表现 HTML 或 XML 等文件样式的计算机语言。CSS 不仅可以静态地修饰网页,还可以配合各种脚本语言动态地对网页各元素进行格式化。