JavaScript 参考手册
Style fontVariant 属性
更改字体为小型大写字母
源代码:
点击运行 »
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>蜜蜂教程(mifengjc.com)</title> <script> function displayResult() { document.getElementById("p1").style.fontVariant = "small-caps"; } </script> </head> <body> <p id="p1">This is some text.</p> <p>THIS IS SOME TEXT.</p> <br> <button type="button" onclick="displayResult()">修改字体</button> </body> </html>
运行结果:
点击运行 »