HTML DOM fontVariant 属性

定义和用法

fontVariant 属性用于设置小型大写字母的字体显示文本

语法:

Object.style.fontVariant=normal|small-caps

可能的值

描述
normal 默认。浏览器会显示一个标准的字体。
small-caps 浏览器会显示小型大写字母的字体。

实例

本例把第一段设置为小型大写字母:

<html>
<head>
<script type="text/javascript">
function setSmallCaps()
{
document.getElementById("p1").style.fontVariant="small-caps";
}
</script>
</head>
<body>

<p id="p1">This is an example paragraph.</p>
<p>This is another example paragraph.</p>

<input type="button" onclick="setSmallCaps()" 
value="Display small-caps font" />

</body>
</html>