Files
freeCodeCamp/guide/chinese/css/text-align/index.md
2018-10-16 21:32:40 +05:30

49 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Text Align
localeTitle: 文字对齐
---
## 文字对齐
此CSS属性描述了其父块元素中内联内容的水平对齐方式。 `text-align`不控制块元素的对齐,它只影响它们的内联内容。
### 价值观:
`text-align`属性指定为从以下值列表中选择的单个关键字:
`text-align: left;`将文本对齐到左侧
`text-align: right;`将文本对齐
`text-align: center;`将文本与中心对齐
`text-align: justify;`使线条宽度相同
`text-align: justify-all;`使线条宽度相同,包括最后一条线条
`text-align: start;`对齐行首的最后一行
`text-align: end;`对齐行尾的最后一行
`text-align: match-parent;`计算值开始和结束父母的方向,并替换为适当的左或右值。
**块对齐值(非标准语法)**
`text-align: -moz-center;`
`text-align: -webkit-center;`
**全球价值观**
`text-align: inherit;`继承自其父元素
`text-align: initial;`默认值
`text-align: unset;`应用inherit或initial值具体取决于元素的默认属性
#### 更多信息:
* [CSS1规格](https://www.w3.org/TR/REC-CSS1/#text-align)
* [CSS2规格](https://www.w3.org/TR/CSS21/text.html#alignment-prop)
* [CSS3规格](https://www.w3.org/TR/css-text-3/#justification)
* [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align)
* [CSS技巧](https://css-tricks.com/almanac/properties/t/text-align/)