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
Whether you're new to XML or already an advanced user, the user-friendly views
and powerful entry helpers, wizards, and debuggers in XMLSpy are designed to
meet your XML and Web services development needs from start to finish.
- XML editor
- Graphical XML Schema / DTD editors
- XSLT 1.0/2.0 editor, debugger, profiler
- XQuery editor, debugger, profiler
- Support for Office Open XML (OOXML)
- Graphical WSDL editor & SOAP debugger
- Java, C#, C++ code generation
- And much more!
Download a free 30-day trial today!
Click to see a demo!
Learn what’s new in v2008
 |
|
Get Your Diploma!
W3Schools' Online Certification Program is the perfect solution for busy
professionals who need to balance work, family, and career building.
The HTML Certificate is for developers who want to document their knowledge of HTML, XHTML, and CSS.
The ASP Certificate is for developers who want to document their knowledge of ASP, SQL, and ADO.
|
|