HTML DOM font Property
Complete Style Object Reference
Definition and Usage
The font property sets all font properties in one declaration.
Syntax
Possible Values
Value |
Description |
fontStyle
fontVariant
fontWeight
fontSize/lineHeight
fontFamily |
Sets the properties for a font |
caption |
Defines the font used for captioned controls
(like buttons, drop-downs, etc.) |
icon |
Defines the font used to label icons |
menu |
Defines the font used in menus |
message-box |
Defines the font used in dialog boxes |
small-caption |
Defines the font used for labeling small controls |
status-bar |
Defines the font used in the window status bar |
Example
The following example changes the font of a text:
<html>
<head>
<script type="text/javascript">
function setFont()
{
document.getElementById("p1").style.font="italic bold 12px arial,serif";
}
</script>
</head>
<body>
<p id="p1">This is an example paragraph.</p>
<input type="button" onclick="setFont()" value="Change paragraph style" />
</body>
</html>
|
Try-It-Yourself Demos
font -
Change the font of a text
Complete Style Object Reference
Learn XML with <oXygen/> XML Editor - Free Trial!
|
|
oXygen helps you learn to define,
edit, validate and transform XML documents. Supported technologies include XML Schema,
DTD, Relax NG, XSLT, XPath, XQuery, CSS.
Understand in no time how XSLT and XQuery work by using the intuitive oXygen debugger!
Do you have any XML related questions? Get free answers from the oXygen
XML forum
and from the video
demonstrations.
Download a FREE 30-day trial today!
|
|