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


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

示例

实际演示

<!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>

更新时间:30-Jun-2020

219 次查看

开启您的 职业生涯

完成课程,获得认证

开始学习
广告
© . All rights reserved.