使用 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.