使用 CSS 加上動畫效果 text-decoration-color 屬性


要透過 CSS 在 text-decoration 屬性上執行動畫,你可以嘗試執行以下程式碼 −

示例

動態演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         #demo {
            position: absolute;
            right: 0;
            width: 300px;
            height: 200px;
            background-color: blue;
            text-decoration: underline;
            animation: myanim 3s infinite;
         }
         @keyframes myanim {
            30% {
               right: 350px;
               text-decoration-color: orange;
            }
         }
      </style>
   </head>
   <body>
      <h1>CSS text-decoration-color property</h1>
      <div id = "demo">
         <h1>This is demo text.</h1>
      </div>
   </body>
</html>

更新時間:2020 年 6 月 12 日

174 次檢視

開啟你的 職業生涯

完成課程獲取認證

開始學習
廣告
© . All rights reserved.