如何使用 JavaScript 設定以小型大寫字母顯示的字型?
要以小型大寫字母設定字型,請使用fontVariant 屬性。
示例
你可以嘗試執行以下程式碼,使用 JavaScript 來設定字型以顯示為小型大寫字母 −
<!DOCTYPE html>
<html>
<body>
<h1>Heading 1</h1>
<p id="myID">
This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text.
This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text.
</p>
<button type="button" onclick="display()">Set Font Family and Font Variant</button>
<script>
function display() {
document.getElementById("myID").style.fontFamily = "verdana,sans-serif";
document.getElementById("myID").style.fontVariant = "small-caps";
}
</script>
</body>
</html>
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP