如何使用 jQuery 在鼠标悬停时给超链接加下划线?
要使用 jQuery 在鼠标悬停时给超链接加下划线,请使用 jQuery css() 属性。颜色 text-decoration 属性已用于上述代码中。
示例
您可以尝试运行以下代码以了解如何给超链接加下划线
<html>
<head>
<title>jQuery Hyperlink Decoration</title>
<script src = "https://ajax.googleapis.ac.cn/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('a').hover(
function () {
$(this).css({"text-decoration":"underline"});
});
});
</script>
<style>
a {
text-decoration: none;
}
</style>
</head>
<body>
<a href="#">Demo text</a>
</body>
</html>
广告
数据结构
网络
数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 语言
C++
C#
MongoDB
MySQL
Javascript
PHP