1、css3 动态button展示学习

效果图:

1、首先创建html代码:

html 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>关注我</button>
</body>
</html>

2、展示css3代码:

css 复制代码
button{
        width: 120px;
        height: 38px;
        background-color: transparent;
        color: #000;
        border: none;
        border-radius: 5px;
        cursor: pointer;
        font-size: 20px;
        font-weight: 600;
        font-family: Arial, Helvetica, sans-serif;
        box-sizing: border-box;
        position: relative;
        transition: all 0.6s ease-in-out;
    }
    button:after{
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 1px;
        height: inherit;
        background-color: #333;
        z-index: -1;
        transition: all 0.6s ease-in-out;
    }
    button:hover{
        color: aliceblue;
        cursor: pointer;
    }
    button:hover:after{
        width: 100%;
        border-radius: 6px;
    }

本人也是学习阶段,希望能够一起学习,高手请留余地勿喷。

相关推荐
飞翔中文网5 分钟前
Java学习笔记之泛型
java·笔记·学习
祀爱9 分钟前
ControllerBase 类将对象转换为 JSON 格式并返回前端的方法
前端·json·asp.net
huangdong_12 分钟前
有什么软件可以下载淘宝和天猫店铺的商品图片?——从工具推荐到技术原理的完整解答
java·前端·数据库
li星野12 分钟前
RAG优化系列:自适应检索(Adaptive Retrieval)——让系统智能选择是否检索
人工智能·python·学习
2401_8784545313 分钟前
前端性能优化复习
前端·性能优化
Tiffany_Ho13 分钟前
Derek-Callan-business-english: 用现代前端技术打造高效商务英语学习平台
前端·typescript·node.js
晓得迷路了21 分钟前
栗子前端技术周刊第 131 期 - pnpm 11.3、npm 11.16.0、Astro 6.4...
前端·javascript·css
kyriewen9 小时前
微软用Go重写TypeScript编译器,速度提升10倍,网友:这是“背叛”还是“救赎”?
前端·typescript·ecmascript 6
Ceelog9 小时前
久坐党自救指南:屏幕前 8 小时,身体到底在经历什么
前端·后端