freeCodeCamp/guide/chinese/html/attributes/p-align-attribute/index.md

42 lines
887 B
Markdown

---
title: P Align Attribute
localeTitle: P对齐属性
---
## P对齐属性
### 重要
HTML5不支持此属性。建议使用[`text-align` CSS属性](https://guide.freecodecamp.org/css/text-align) 。
要在`<p>`标记内对齐文本,此属性将有所帮助。
### 句法
```html
<p align="position">Lorem Ipsum...</p>
```
### 属性
* **left** - 文本**左**对齐
* **right** - 文本**右**对齐
* **center** - 文本与中心对齐
* **对齐** - 所有文本行的宽度相等
### 例
```html
<html>
<body>
<p align="center">Paragraph align attribute example</p>
</body>
</html>
```
#### 更多信息:
* [CSS `text-align`](https://guide.freecodecamp.org/css/text-align)
* [W3 - HTML 4.01规范](https://www.w3.org/TR/html401/struct/text.html#h-9.3.1)
* [MDN - CSS文本对齐](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align)