通过使用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>