The CSS text properties define the appearance of text.
CSS文字属性可用来定义文字的外观

设置文字的颜色 Set the color of the text
以下是示例代码:
<html>
<head>
<style type="text/css">
h1 {color: #00ff00}
h2 {color: #dda0dd}
p {color: rgb(0,0,255)}
</style>
</head>
<body>
<h1>标题一</h1>
<h2>标题二</h2>
<p>段落</p>
</body>
</html>
设置文字背景色 Set the background-color of the text
以下是示例代码:
<html>
<head>
<style type="text/css">
span.highlight
{
background-color:yellow
}
</style>
</head>
<body>
<p>
<span class="highlight">This is a text.</span> This is a text. This is a text. <span class="highlight">xwangye.com </span>This is a text. This is a text. This is a text. This is a text. This is a text. This is a text. <span class="highlight">This is a text.</span>
</p>
</body>
</html>
指定相邻字符的间隙 Specify the space between characters
以下是示例代码:
<html>
<head>
<style type="text/css">
h1 {letter-spacing: -3px}
h4 {letter-spacing: 0.5cm}
</style>
</head>
<body>
<h1>This is header 1</h1>
<h4>This is header 4</h4>
<br />
<h1>www.xwangye.com</h1>
</body>
</html>
对齐文字 Align the text
以下是示例代码:
<html>
<head>
<style type="text/css">
h1 {text-align: center}
h2 {text-align: left}
h3 {text-align: right}
</style>
</head>
<body>
<h1>This is header 1</h1>
<h2>This is header 2</h2>
<h3>This is header 3</h3>
</body>
</html>
文字修饰 Decorate the text
以下是示例代码:
<html>
<head>
<style type="text/css">
h1 {text-decoration: overline}
h2 {text-decoration: line-through}
h3 {text-decoration: underline}
a {text-decoration: none}
</style>
</head>
<body>
<h1>This is header 1</h1>
<h2>This is header 2</h2>
<h3>This is header 3</h3>
<p><a href="http://www.xwangye.com">This is a link: www.xwangye.com</a></p>
</body>
</html>
文字在段落中缩进 Indent text
以下是示例代码:
<html>
<head>
<style type="text/css">
p {text-indent: 1cm}
</style>
</head>
<body>
<p>
This is some text in a paragraph
This is some text in a paragraph
This is some text in a paragraph
This is some text in a paragraph
This is some text in a paragraph
This is some text in a paragraph
</p>
</body>
</html>
控制文字中的字母 Control the letters in a text
以下是示例代码:
<html>
<head>
<style type="text/css">
p.uppercase {text-transform: uppercase}
p.lowercase {text-transform: lowercase}
p.capitalize {text-transform: capitalize}
</style>
</head>
<body>
<p class="uppercase">This is some text in a paragraph</p>
<p class="lowercase">This is some text in a paragraph</p>
<p class="capitalize">This is some text in a paragraph</p>
</body>
</html>
CSS Text Properties
CSS 文字属性
   CSS文字属性允许你控制文字的外观。这可以改变文字的颜色,增加或者缩短文字的间距,文字的对齐,装饰,第一行文字的缩进,还有其他... <!--em336tj start--><!--em336tj end-->