📄 pr_font_font.asp@output=print
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS Font Property</title>
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Keywords" content="xml,tutorial,html,dhtml,css,xsl,xhtml,javascript,asp,ado,vbscript,dom,sql,colors,soap,php,authoring,programming,training,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,tags,demos,tips,links,FAQ,tag list,forms,frames,color table,w3c,cascading style sheets,active server pages,dynamic html,internet,database,development,Web building,Webmaster,html guide" />
<meta name="Description" content="Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building." />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "../../https@ssl./default.htm" : "../../www./default.htm");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3855518-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</head>
<body>
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
<h1>CSS font Property</h1>
<hr />
<a href="css_reference.asp"><img class="navup" src="../images/up.gif" alt="CSS Reference" border="0" /> Complete CSS Reference</a>
<hr />
<h2>Definition</h2>
<p>The font property is, with exception of some system fonts, a shorthand property for setting all of the properties for a font in one
declaration.</p>
<p><b>Inherited:</b> Yes</p>
<p><b>Note:</b> This property also has a sixth value: "line-height",
which sets the space between lines.</p>
<hr />
<h2><b>JavaScript Syntax</b></h2>
<p>CSS properties can also be dynamically changed with a JavaScript.</p>
<p><b>Scripting Syntax:</b> <i>object</i>.style.font="italic bold 12px
arial,serif"</p>
<p>In our HTML DOM tutorial you can find more details about the
<a href="../htmldom/prop_style_font.asp">font property</a>.</p>
<p>In our HTML DOM tutorial you can also find a full
<a href="../htmldom/dom_obj_style.asp">Style Object Reference</a>.</p>
<hr />
<h2>Example</h2>
<table class="ex" cellspacing="0" border="1" width="100%" cellpadding="3">
<tr>
<td valign="top">p<br />
{<br />
font: 12px arial<br />
}
<p>p<br />
{<br />
font: italic small-caps bold 12px arial<br />
}</p>
p<br />
{<br />
font: oblique small-caps 900 12px/14px arial<br />
}
<p>
p<br />
{<br />
font: menu<br />
}</p>
</td>
</tr>
</table>
<h2>Possible Values</h2>
<table class="ex" cellspacing="0" border="1" width="100%" cellpadding="3">
<tr>
<th align="left" valign="top">Value</th>
<th align="left" valign="top">Description</th>
</tr>
<tr>
<td valign="top"><i>font-style<br />
font-variant<br />
font-weight<br />
font-size/line-height<br />
font-family </i></td>
<td valign="top">Sets the properties for a font. The line-height value sets
the space between lines. The value can be a number, a %, or a font size.<p>
Default value: Browser dependent</p></td>
</tr>
<tr>
<td valign="top">caption</td>
<td valign="top">Defines the font that are used by captioned controls (like
buttons, drop-downs, etc.)</td>
</tr>
<tr>
<td valign="top">icon</td>
<td valign="top">Defines the fonts that are used by icon labels</td>
</tr>
<tr>
<td valign="top">menu</td>
<td valign="top">Defines the fonts that are used by dropdown menus</td>
</tr>
<tr>
<td valign="top">message-box</td>
<td valign="top">Defines the fonts that are used by dialog boxes</td>
</tr>
<tr>
<td valign="top">small-caption</td>
<td valign="top"> </td>
</tr>
<tr>
<td valign="top">status-bar</td>
<td valign="top">Defines the fonts that are used by window status bars</td>
</tr>
</table>
<br />
<hr />
<h2>Try-It-Yourself Demos</h2>
<p><a target="_blank" href="tryit.asp@filename=trycss_font">All the font properties in one
declaration</a><br />
This example demonstrates how to use the shorthand property for setting all of
the font properties in one declaration.</p>
<p><a target="_blank" href="tryit.asp@filename=trycss_font_caption">Set a
paragrap font using the "caption" value</a><br />
This example demonstrates how to set a paragrap font using the "caption" value.</p>
<hr />
<a href="css_reference.asp"><img class="navup" src="../images/up.gif" alt="CSS Reference" border="0" /> Complete CSS Reference</a>
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -