伪元素小特效

复制代码
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    a {
      text-decoration: none;
      color: #555;
      outline: none;
      cursor: pointer;
      border-bottom: 1px solid #999;
    }

    /* line-link */
    .line-link {
      position: relative;
      display: inline-block;
      border-bottom: none;
    }

    .line-link:hover::before {
      visibility: visible;
      transform: scaleX(1);
    }

    .line-link::before {
      content: "";
      position: absolute;
      width: 100%;
      height: 2px;
      bottom: 0;
      left: 0;
      background-color: #000;
      visibility: hidden;
      transform: scaleX(0);
      transition-duration: 0.2s;
      transition-timing-function: ease-in-out;
      transition-delay: 0s;
    }

    /* bg-link */
    .bg-link {
      display: inline-block;
      padding: 0 20px;
      font-size: 14px;
      color: #555;
      background: #fff;
      border: 2px solid #555;
      text-decoration: none;
      border-radius: 2px;
      transition-property: background-color;
      transition-duration: 0.2s;
      transition-timing-function: ease-in-out;
      transition-delay: 0s;
      line-height: 2;
    }
    .bg-link:hover{
      border-color: #222;
      color: #fff;
      background: #222;
    }
  </style>
</head>

<body>
  <a href="#" class="line-link">line link</a>
  <a href="#" class="bg-link">bg link</a>
</body>

</html>
View Code
复制代码

 

后语:

伪元素 + 组合变形 == 万千世界

posted @   justSmile2  阅读(176)  评论(0编辑  收藏  举报
编辑推荐:
· 智能桌面机器人:用.NET IoT库控制舵机并多方法播放表情
· Linux glibc自带哈希表的用例及性能测试
· 深入理解 Mybatis 分库分表执行原理
· 如何打造一个高并发系统?
· .NET Core GC压缩(compact_phase)底层原理浅谈
阅读排行:
· 手把手教你在本地部署DeepSeek R1,搭建web-ui ,建议收藏!
· 新年开篇:在本地部署DeepSeek大模型实现联网增强的AI应用
· Janus Pro:DeepSeek 开源革新,多模态 AI 的未来
· 互联网不景气了那就玩玩嵌入式吧,用纯.NET开发并制作一个智能桌面机器人(三):用.NET IoT库
· 【非技术】说说2024年我都干了些啥
点击右上角即可分享
微信分享提示