CSS手册简编:文本属性

来源:互联网 发布:会计软件开发 编辑:程序博客网 时间:2024/04/29 18:23
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
TRONG>CSS属性:

6、文本(Text)属性:

这里的属性将影响WEB文档中的文本显示情况。

text-indent属性描述文本的缩进程度:

属性名称: 'text-indent'
属性值: <length> | <percentage>
初始值: 0
适合对象: 容器元素
是否继承: yes
百分比备注: 根据父元素的宽度而定

下面的例子表明段落的缩进值为3em

P { text-indent: 3em }

Alignment属性表明文本的对齐方式:

属性名称: 'alignment'
属性值: left | right | center | justify
初始值: 依照用户定义
适合对象: block-level elements
是否继承: yes
百分比备注: 被禁止


text-decoration属性描述对文本的修饰方法:

属性名称: 'text-decoration'
属性值: none | [ underline || overline || line-through || blink ]
初始值: none
适合对象: 所有元素
是否继承: no (see clarification below)
百分比备注: 被禁止

属性值含义分别为:
underline:下划线。
overline:上划线。
line-through:删除线。
blink:闪烁(如同Navigator中的blink标记的功能)

text-shadow属性可以为文本加入阴影的特效:

属性名称: 'text-shadow'
属性值: none | <color> [, <color> ]*
初始值: none
适合对象: all
是否继承: No
百分比备注: 只在描述透明度时有效

例如:

P { text-shadow: black }

上例将在文本的右下方显示黑色阴影,另外阴影将增大BOX的面积。

letter-spacing属性表明文本的字间距:属性名称: 'letter-spacing'

属性值: normal | <length> | auto
初始值: normal
适合对象: 所有元素
是否继承: yes
百分比备注: 被禁止

例如:

BLOCKQUOTE { letter-spacing: 0.1em }

word-spacing属性表明文本中单词间距:

属性名称: 'word-spacing'
属性值: normal | <length>
初始值: normal
适合对象: 所有元素
是否继承: yes
百分比备注: 被禁止

例如:

H1 { word-spacing: 1em }

text-transform属性可以将BOX内的文本按指定的大写或小写形式显示:

属性名称: 'text-transform'
属性值: capitalize | uppercase | lowercase | none
初始值: none
适合对象: 所有元素
是否继承: yes
百分比备注: 被禁止

属性值含义为:
capitalize:把BOX中的每句句首字母变成大写。
uppercase:把BOX中所有的字母变成大写。
lowercase:把BOX中所有的字母变成小写。

White-space属性描述如何显示文本中的空格,在HTML中,空格是被省略的,也就是说你在一个段落标记的开头无论输入多少个空格都是无效的,要输入空格有两个方法,一是直接输入空格的代码"&nbsp;",或者使用<pre>标记,CSS中也制定了类似于pre的属性:

属性名称: 'white-space'
属性值: normal | pre | nowrap
初始值: normal
适合对象: 容器元素
是否继承: yes
百分比备注: 被禁止

例如:

PRE { white-space: pre }
P { white-space: normal }

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击