使用 CSS 在圖片懸停時顯示藍色陰影


要顯示影像懸停時的陰影,請使用 CSS box-shadow 屬性

示例

即時演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         img {
            border: 2px solid orange;
            border-radius: 3px;
            padding: 7px;
         }
         img:hover {
            box-shadow: 0 0 2px 2px blue;
         }
      </style>
   </head>
   <body>
      <img src = "https://tutorialspoint.tw/videotutorials/images/coding_ground_home.jpg" alt="Online Compiler" width="300" height="300">
   </body>
</html>

更新於: 2020 年 6 月 24 日

2K+ 次瀏覽

開啟你的 事業

完成課程以獲得認證

開始學習
廣告