使用 CSS 為陰影新增顏色


要為陰影新增顏色,請使用 box-shadow 屬性並設定顏色,以及高度和寬度。

你可以嘗試執行以下程式碼為陰影設定顏色

示例

線上演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         h2 {
            box-shadow: 10px 10px green;
            height: 70px;
            background-color: red;
         }
      </style>
   </head>
   <body>
      <h2>Heading Two</h2>
      <p>Above heading has shadow.</p>
   </body>
</html>

更新於:23-6-2020

206 次瀏覽

開啟你的職業生涯

透過完成課程獲得認證

開始
廣告
© . All rights reserved.