学习CSS使用技巧教程(6)文字属性

<script type="text/javascript"> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
  上一节: 自定义类别

  文字属性

  文字属性是可以设置文字的颜色、大小、字型、粗细等等。

原始代码

<STYLE>
SPAN.c1 {color:red;position:relative;font-size:12px;font-family:Arial;font-weight:700}
SPAN.c2 {color:blue}
SPAN.c3 {color:green}
SPAN.c4 {color:pink}
</STYLE>

<SPAN CLASS=c1>A</SPAN>
<SPAN CLASS=c2>B</SPAN>
<SPAN CLASS=c3>C</SPAN>
<SPAN CLASS=c4>D</SPAN>

显示结果 A
B
C
D

  文字颜色 { COLOR }

  语法:{ COLOR : ( color ) }

原始代码 <STYLE>
SPAN.test {color:red}
</STYLE>

<SPAN CLASS=test>A B C D</SPAN> 显示结果 A B C D

  文字类别 { FONT }

  设置字体样式、大小写变化、粗细、大小、文字行列高度、字型

  语法:{ FONT : ( font-style )︱( font-variant )︱( font-weight )︱( font-size )︱( font-family )︱/ ( line-height ) }

原始代码 <STYLE>
SPAN.test {FONT:ITALIC BOLD 12pt/18pt}
</STYLE>

<SPAN CLASS=test>A B C D</SPAN> 显示结果 A B C D

  下载字型 { @FONT-FACE }

  语法:@FONT-FACE { FONT-FAMILY : ( font-family ) ; SRC : URL ( url ) }

原始代码 <STYLE>
@FONT-FACE { FONT-FAMILY : (未定) ; SRC : URL ( 下载地址 ) }
</STYLE> 显示结果 没有结果

  文字字型 { FONT-FAMILY }

  语法:{ FONT-FAMILY : ( font-name )︱( generic-family ) }

原始代码 <STYLE>
SPAN.test {FONT-FAMILY:"Arial Black"}
</STYLE>

<SPAN CLASS=test>A B C D</SPAN> 显示结果 A B C D


  文字大小 { FONT-SIZE }

  设定字体大小 ( 可设单位属性 : 点 pt、英寸 in、公分 cm、像素 px、百分比 % )

  语法:{ FONT-SIZE : LARGE︱MEDIUM︱SMALLER︱( length )︱( percentage ) }

原始代码 <STYLE>
SPAN.test1 {FONT-SIZE:LARGE}
SPAN.test2 {FONT-SIZE:10pt}
SPAN.test3 {FONT-SIZE:50%}
</STYLE>

<SPAN CLASS=test>A B C D</SPAN>
<SPAN CLASS=test1>E F G H</SPAN>
<SPAN CLASS=test2>I J K L</SPAN> 显示结果 A B C D
E F G H
I J K L

  文字样式 { FONT-STYLE }

  设定字体样式 ( 分为 : 正常、斜体 )

  语法:{ FONT-STYLE : NORMAL︱ITALIC }

原始代码 <STYLE>
SPAN.test1 {FONT-STYLE:ITALIC}
</STYLE>

<SPAN CLASS=test>A B C D</SPAN> 显示结果 A B C D

  文字变化 { FONT-VARIANT }

  设定字体变化 ( 分为 : 正常、小字体 )

  语法:{ FONT-VARIANT : NORMAL︱SMALL-CAPS }

原始代码 <STYLE>
SPAN.test1 {FONT-VARIANT:SMALL-CAPS}
</STYLE>

<SPAN CLASS=test>A B C D</SPAN> 显示结果 A B C D

  文字粗细 { FONT-WEIGHT }

  设定字体粗细 ( 分为 : 正常、粗字体 )

  语法:{ FONT-WEIGHT : NORMAL︱BOLD }

原始代码 <STYLE>
SPAN.test1 {FONT-WEIGHT:BOLD}
</STYLE>

<SPAN CLASS=test>A B C D</SPAN> 显示结果 A B C D

  下一节:连接属性

<script type="text/javascript"> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值