CSS字体属性
CSS字体属性
字体名称属性(font-family)
这个属性设定字体名称,如Arial, Tahoma, Courier等。例句如下:
.s1 {font-family:Arial}
看案例:
<html>
<head>
<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 browser default font.</p>
<p class = "s1">The fon-family value of the text is "Arial"。</p>
<p class = "s2">The fon-family value of the text is "Tahoma"。</</p>
<p class = "s3">The fon-family value of the text is "Courer"。</</p>
<p class = "s4">The fon-family value of the text is "Verdana"。</</p>
<p class = "s5">The fon-family value of the text is "Book Antiqua"。</</p>
</body>
</html>
字体大小属性(font-size)
这个属性可以设置字体的大小。字体大小的设置可以有多种方式,最常用的就是pt和px(pixel)。例句如下:
.s2 {font-size:16pt}
看案例:
<html>
<head>
<title>字体大小属性 font-size</title>
<STYLE>
BODY{font-size:10pt}
.s1 {font-size:16px}
.s2 {font-size:16pt}
.s3 {font-size:80%}
.s4 {font-size:larger}
.s5 {font-size:xx-large}
</STYLE>
</head>
<body>
<p>这段文字大小是10pt。</p>
<p class = "s1">这段文字大小是16px。</p>
<p class = "s2">这段文字大小是16pt。</p>
<p class = "s3">这段文字大小是10pt的80%。</p>
<p class = "s4">这段文字的大小比10pt大。</p>
<p class = "s5">这段文字的大小是特大号(xx-large)。</p>
</body>
</html>
字体风格属性(font-style)
这个属性有三个值可选:normal, italic, oblique。normal是缺省值,italic, oblique都是斜体显示。例句如下:
.s1 {font-sytle:italic}
看案例:
<html>
<head>
<title>字体风格属性 font-style</title>
<STYLE>
.s1 {font-style:italic}
.s2 {font-style:oblique}
</STYLE>
</head>
<body>
<p>这段文字风格是normal,正常显示。normal是字体风格属性(font-style)的缺省值。</p>
<p class = "s1">这段文字的字体风格(font-style)属性值是italic,斜体显示。</p>
<p class = "s2">这段文字的字体风格(font-style)属性值是oblique,斜体显示。</p>
</body>
</html>
字体浓淡属性(font-weight)
这个属性常用值是normal和bold,normal是缺省值。例句如下:
<p style = "font-weight:bold">这段文字字体的浓淡属性(font-weight)值是bold。<p>
看案例:
<html>
<head>
<title>字体浓淡属性 font-weight</title>
</head>
<body>
<p>这段文字没有设浓淡属性。<p>
<p style = "font-weight:bold">这段文字字体的浓淡属性(font-weight)值是bold。<p
CSS字体属性 来自淘豆网m.daumloan.com转载请标明出处.