使用 CSS 设置鼠标悬停时的链接样式

cssweb developmentfront end technology更新于 2025/5/15 10:20:17

要使用 CSS 设置鼠标悬停时的链接样式,请使用 CSS: hover 选择器。您可以尝试运行以下代码来实现: hover, 选择器,

示例

<!DOCTYPE html>
<html>
   <head>
      <style>
         a:hover {
            background-color: orange;
         }
      </style>
   </head>
   <body>
      <a href = "https://www.google.com">Google</a>
      <p>Keep the mouse cursor on the above link and see the effect.</p>
   </body>
</html>

相关文章


有用资源