使用 CSS 在鼠标悬停时翻转图片

cssweb developmentfront end technology更新于 2024/7/25 11:24:17

使用 CSS 的 transform 属性翻转图片。您可以尝试运行以下代码,在鼠标悬停时翻转图片:

示例

<!DOCTYPE html>
<html>
   <head>
      <style>
         .myimg:hover {
            transform: scaleX(-1);
         }
      </style>
   </head>
   <body>
      <h2>Heading One</h2>
      <p>Let's flip the image on mouse over:</p>
      <img class = "myimg" src = "https://www.cainiaomax.com/python/images/python_data_science.jpg"
         alt = "Python Data Science" width = "300" height = "200">
   </body>
</html>


相关文章


有用资源