使用 jQuery 使文字加粗、傾斜和加下劃線
使用 jQuery 使文字加粗、傾斜和加下劃線,可使用 jQuery css() 方法,並帶有 CSS 屬性 font-style、font-weight 和 text-decoration。你可以嘗試執行以下程式碼,以瞭解如何使用 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-style": "italic", "font-weight": "bold","text-decoration": "underline"}); } }); }); </script> </head> <body> <p>Move the mouse pointer on the text to make text bold, italic and underline.</p> </body> </html>
廣告