常用CSS属性(一)

Eddy 发布于2009-11-1 12:4:6 分类: 网站相关 已浏览loading 网友评论0条 我要评论

从今天开始,帖点学习CSS的学习摘要。

1、字体属性

字体名称属性(font-family)
这个属性设定字体名称,如Arial, Tahoma, Courier等。

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>字体名称属性(font-family)</title>
<style>
.s1{font-family:Arial}
.s2{font-family:Tahoma}
.s3{font-family:Courier}
.s4{font-family:Verdana}
.s5{font-family:"Book Antiqua"}
</style>
</head>

<body>
<p>The font-family value of the text is the default font.</p>
<p class="s1">The font-family value of the text is "Arial".</p>
<p class="s2">The font-family value of the text is "Tahoma".</p>
<p class="s3">The font-family value of the text is "Courier".</p>
<p class="s4">The font-family value of the text is "Verdana".</p>
<p class="s5">The font-family value of the text is "Book Antiqua".</p>
</body>
</html>

另外,还有如下一些属性:

字体大小属性(font-size)
这个属性可以设置字体的大小。字体大小的设置可以有多种方式,最常用的就是pt和px(pixel)。例句如下:
.s2 {font-size:16pt}

字体风格属性(font-style)
这个属性有三个值可选:normal, italic, oblique。normal是缺省值,italic, oblique都是斜体显示。例句如下:
.s1 {font-sytle:italic}

字体浓淡属性(font-weight)
这个属性常用值是normal和bold,normal是缺省值。例句如下:
<p style = "font-weight:bold">这段文字字体的浓淡属性(font-weight)值是bold。<p>

字体变量属性(font-variant)
这个属性有两个值,normal和small-caps,normal是缺省值。small-caps表示小的大写字体。例句如下:
.s1 {font-variant:small-caps}

字体属性(font)
这个属性是各种字体属性的一种快捷的综合写法。这个属性可以综合字体风格属性(font-style),字体变量属性(font-variant),字体浓淡属性(font-weight),字体大小属性(font-size)等属性。例句如下:
.s1 {font:italic normal bold 11pt arial}

字体颜色(color)
字体颜色用CSS中的color属性来表示。

已经有(0)位网友发表了评论,你也评一评吧!
原创文章如转载,请注明:转载自Eddy Blog
原文地址:http://www.rrgod.com/webdesign/50.html     欢迎订阅Eddy Blog

关于 CSS  属性  的相关文章

记住我的信息,下次不用再输入 欢迎给Eddy Blog留言