---
title: "第6章 文本属性==>文本缩进 P135"
author: "conkeyn"
date: "2009-05-24T19:55:00Z"
tags: ["CSS", "HTML", "XHTML"]
slug: "6-p135"
draft: false
lastmod: "2009-06-05T21:34:09Z"
id: 394779
url: "https://conkeyn.iteye.com/blog/394779"
---

通过使用text-index属性，所有元素的第一行都可以缩进一个给定长度，甚至该长度可以是负值。当然，这个属性最常见的用途是将段落的首行缩进：

```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
p{
	text-indent:2em;
}
</style>
</head>

<body>
<p>
This is paragraph element,which means that the first line will be indented a quarter-inch.The other lines in the paragraph will not be indented,no matter how long the paragraph many be.
</p>
</body>
</html>
```

 ![](/upload/attachment/107252/d96e234f-c05a-375d-8d75-9d119319567d.jpg)