HTML DOM fontVariant 属性

定义和用法

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

语法:

  1. Object.style.fontVariant=normal|small-caps

可能的值

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

实例

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

  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function setSmallCaps()
  5. {
  6. document.getElementById("p1").style.fontVariant="small-caps";
  7. }
  8. </script>
  9. </head>
  10. <body>
  11.  
  12. <p id="p1">This is an example paragraph.</p>
  13. <p>This is another example paragraph.</p>
  14.  
  15. <input type="button" onclick="setSmallCaps()"
  16. value="Display small-caps font" />
  17.  
  18. </body>
  19. </html>