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;
    }

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

相关推荐
掘金安东尼3 小时前
让 JavaScript 更容易「善后」的新能力
前端·javascript·面试
掘金安东尼3 小时前
用 HTMX 为 React Data Grid 加速实时更新
前端·javascript·面试
灵感__idea5 小时前
Hello 算法:众里寻她千“百度”
前端·javascript·算法
yinuo6 小时前
轻松接入大语言模型API -04
前端
袋鼠云数栈UED团队6 小时前
基于 Lexical 实现变量输入编辑器
前端·javascript·架构
cipher7 小时前
ERC-4626 通胀攻击:DeFi 金库的"捐款陷阱"
前端·后端·安全
UrbanJazzerati7 小时前
非常友好的Vue 3 生命周期详解
前端·面试
AAA阿giao7 小时前
从零构建一个现代登录页:深入解析 Tailwind CSS + Vite + Lucide React 的完整技术栈
前端·css·react.js
兆子龙8 小时前
像 React Hook 一样「自动触发」:用 Git Hook 拦住忘删的测试代码与其它翻车现场
前端·架构
兆子龙8 小时前
用 Auto.js 实现挂机脚本:从找图点击到循环自动化
前端·架构