HTML DOM fontSize Property
Complete Style Object Reference
Definition and Usage
The fontSize property sets the font size of an element.
Syntax
Object.style.fontSize=value
|
Possible Values
Value |
Description |
xx-small
x-small
small
medium
large
x-large
xx-large |
Sets the size of the font to different sizes, from
xx-small to xx-large |
smaller |
Sets the font-size to a smaller size than the parent
element |
larger |
Sets the font-size to a larger size than the parent
element |
length |
Sets the font-size to a fixed size |
% |
Sets the font-size to a % of the parent element |
Example
The following example changes the font size of a text:
<html>
<head>
<script type="text/javascript">
function setFontSize()
{
document.getElementById("p1").style.fontSize="larger";
}
</script>
</head>
<body>
<p id="p1">This is an example paragraph.</p>
<input type="button" onclick="setFontSize()"
value="Change font-size" />
</body>
</html>
|
Try-It-Yourself Demos
fontSize - Change the font-size 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 fully functional free 30-day trial today!
|