HTML DOM fontWeight Property
Complete Style Object Reference
Definition and Usage
The fontWeight property sets the boldness of characters.
Syntax
Object.style.fontWeight=value
|
Possible Values
Value |
Description |
normal |
Defines normal characters |
lighter |
Defines lighter characters |
bold |
Defines thick characters |
bolder |
Defines thicker characters |
100
200
300
400
500
600
700
800
900 |
Defines from thin to thick characters. 400 is the same
as normal, and 700 is the same as bold |
Example
The following example sets the first paragraph to bold:
<html>
<head>
<script type="text/javascript">
function setFontWeight()
{
document.getElementById("p1").style.fontWeight="900";
}
</script>
</head>
<body>
<p id="p1">This is an example paragraph.</p>
<p>This is another example paragraph.</p>
<input type="button" onclick="setFontWeight()"
value="Display bold text" />
</body>
</html>
|
Try-It-Yourself Demos
fontWeight - Set the text to be bold
Complete Style Object Reference
 |

|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|