白天 |  黑夜

css教程:CSS文字属性的应用

船长 发表于 2009-06-01 10:06 | 分类:css | 阅读数:431 次

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

设置文字的颜色 Set the color of the text
This example demonstrates how to 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>标题二52css.com</h2>
<p>段落</p>
</body>
</html>

设置文字背景色 Set the background-color of the text
This example demonstrates how to set the background-color of a part of the text.
Examples 实例:

<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”>52css.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
This example demonstrates how to increase or decrease the space between characters.
Examples 实例:

<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.52css.com</h1>
</body>
</html>

对齐文字 Align the text
This example demonstrates how to align the text.
Examples 实例:

<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>www.52css.com</h2>
<h3>This is header 3</h3>
</body>
</html>

文字修饰 Decorate the text
This example demonstrates how to add decoration to text.
Examples 实例:
<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.icoolz.com.cn/”>This is a link : icoolz.com.cn</a></p>
</body>
</html>

文字在段落中缩进 Indent text
This example demonstrates how to indent the first line of a paragraph.
Examples 实例:

<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
This example demonstrates how to control the letters in a text.
Examples 实例:

<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>
<p class=”uppercase”>www.52css.com</p>
</body>
</html>

CSS Text Properties
CSS 文字属性
The CSS text properties allow you to control the appearance of text. It is possible to change the color of a text, increase or decrease the space between characters in a text, align a text, decorate a text, indent the first line in a text, and more.
CSS文字属性允许你控制文字的外观。这可以改变文字的颜色,增加或者缩短文字的间距,文字的对齐,装饰,第一行文字的缩进,还有其他…

本站QQ交流群:16524922,一起交流学习,互帮互助
转载请注明出处:http://www.songlecn.com/2009/06/1032/
我要评论 标签: ,
上一篇
下一篇
喜欢web集结号的文章,那就通过 RSS Feed 功能订阅阅读吧!

我要评论

* 必填

* 绝不会泄露


Css Tutorials

web集结号致力于

  • Css技巧及模板
  • Javascript技巧及特效
  • JQuery插件及应用
  • 建站图片资源
  • 网络休闲及生活感悟