UK[fɒnt] US[fɑ:nt]

n. Font; font; baptistery (located in a church, often made of stone); (same font and size) a set of typefaces

Plural: fonts

javascript font attribute syntax

Function:Set all font attributes.

Syntax: Object.style.font=value

javascript font attribute example

<html>
<head>
    <meta charset="UTF-8">
<script type="text/javascript">
function setFont()
{
document.getElementById("p1").style.font="italic bold 12px arial,serif";
}
</script>
</head>
<body>

<p id="p1">这是示例文字</p>

<input type="button" onclick="setFont()" value="Change paragraph style" />

</body>
</html>

Run instance »

Click the "Run instance" button to view the online instance