如何使用 jQuery 更改字體系列和字型大小?
若要使用 jQuery 更改字體系列和字型大小,請使用 jQuery css() 方法。使用 css 屬性 font-family 和 font-size。您可以嘗試執行以下程式碼,以瞭解如何使用 jQuery 更改字體系列和字型大小 −
示例
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$("p").on({
mouseenter: function() {
$(this).css({"font-family": "Arial, Helvetica, sans-serif", "font-size": "200%"});
}
});
});
</script>
</head>
<body>
<p>Move the mouse pointer on the text to change the font family and size.</p>
</body>
</html>
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP