html+css 实现hover 3D按钮特效

前言:哈喽,大家好,今天给大家分享html+css 绚丽效果!并提供具体代码帮助大家深入理解,彻底掌握!创作不易,如果能帮助到大家或者给大家一些灵感和启发,欢迎收藏+关注哦 💕

一、效果

html+css 实现hover 3D按钮特效效果

二、原理解析

1.这是一个,hover 3D悬浮的按钮效果。每个按钮都是由5部分组成,a,a:before,a:after,i,span如下图。

按钮组成

2.当按钮上有鼠标时,hover效果触发,运行transition过渡动画和其他属性变化效果。

/*当hover时*/
a:hover {
    transform: rotate(-30deg) skew(25deg) translate(20px, -15px);
    box-shadow: -50px 50px 50px rgba(0, 0, 0, 0.5);
}

a:hover .iconfont {
    color: #fff;
}

a:hover span {
    color: #fff;
}

a:hover {
    background: #dd4b39;
}

a:hover:before {
    background: #b33a2b;
}

a:hover:after {
    background: #e66a5a;
}

3.具体的变换参数,直接看代码,可以一键复制,查看效果

三、上代码,可以直接复制使用

目录

目录

html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>html+css 实现hover 3D按钮特效</title>
    <link rel="stylesheet" href="https://at.alicdn.com/t/c/font_4646876_7vpdpyxzi9o.css">
    <link rel="stylesheet" href="./style.css">
</head>
<body>
<div class="container">
    <h1 style="text-align: center;color:#fff;margin-bottom: 50px;padding-top: 50px; text-shadow: 0 3px 3px #4c6ed3;">
        html+css 实现hover 3D按钮特效</h1>

    <div class="wrapper">
        <a href="#">
            <i class="iconfont">&#xe63b;</i>
            <span>-求点赞</span>
        </a>
        <a href="#">
            <i class="iconfont">&#xe621;</i>
            <span>-求关注</span>
        </a>
        <a href="#">
            <i class="iconfont">&#xe627;</i>
            <span>-求收藏</span>
        </a>
        <a href="#">
            <i class="iconfont">&#xe628;</i>
            <span>-求转发</span>
        </a>
    </div>
</div>

</body>
</html>

css

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --btn-bg-color: #fff;
    --font-color-black: #000;
    --btn-bg-color-hover: #FF5833;
}

.container {
    min-height: 100vh;
    background-color: #CCCCCC;
}

.wrapper {
    margin-top: 150px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 40px;
}

a .iconfont {
    font-size: 40px;
    color: #333;
    line-height: 80px;
    transition: 0.5s;
    padding-right: 14px;
}

a span {
    padding: 0;
    margin: 0;
    position: absolute;
    top: 30px;
    color: #333;
    letter-spacing: 4px;
    transition: 0.5s;
}


a {
    text-decoration: none;
    position: relative;
    display: block;
    width: 210px;
    height: 80px;
    background: #fff;
    text-align: left;
    padding-left: 20px;
    transform: rotate(-30deg) skew(25deg) translate(0, 0);
    transition: 0.5s;
    box-shadow: -20px 20px 10px rgba(0, 0, 0, 0.5);
}

a:before {
    content: '';
    position: absolute;
    top: 10px;
    left: -20px;
    height: 100%;
    width: 20px;
    background: #b1b1b1;
    transform: 0.5s;
    transform: rotate(0deg) skewY(-45deg);
}

a:after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: -10px;
    height: 20px;
    width: 100%;
    background: #b1b1b1;
    transform: 0.5s;
    transform: rotate(0deg) skewX(-45deg);
}

/*当hover时*/
a:hover {
    transform: rotate(-30deg) skew(25deg) translate(20px, -15px);
    box-shadow: -50px 50px 50px rgba(0, 0, 0, 0.5);
}

a:hover .iconfont {
    color: #fff;
}

a:hover span {
    color: #fff;
}

a:hover {
    background: #dd4b39;
}

a:hover:before {
    background: #b33a2b;
}

a:hover:after {
    background: #e66a5a;
}

到此这篇文章就介绍到这了,更多精彩内容请关注本人以前的文章或继续浏览下面的文章,创作不易,如果能帮助到大家,希望大家多多支持宝码香车~💕

整理不易,点赞关注宝码香车

更多专栏订阅推荐:
👍 html+css+js 绚丽效果
💕 vue
✈️ Electron
⭐️ js
📝 字符串
✍️ 时间对象(Date())操作

  • 21
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
好的,我可以给您提供一个简单的赛博朋克风格的登录界面示例代码,您可以根据自己的需要进行修改和完善。以下是代码: HTML代码: ``` <!DOCTYPE html> <html> <head> <title>Cyberpunk Login</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div class="container"> <h1>Cyberpunk Login</h1> <form> <div class="form-group"> <label for="username">Username:</label> <input type="text" id="username" name="username" placeholder="Enter username"> </div> <div class="form-group"> <label for="password">Password:</label> <input type="password" id="password" name="password" placeholder="Enter password"> </div> <button type="submit" class="btn">Login</button> </form> </div> </body> </html> ``` CSS代码: ``` body { background-color: #000; color: #fff; font-family: 'Courier New', Courier, monospace; font-size: 20px; } .container { width: 500px; margin: 0 auto; text-align: center; padding-top: 100px; } h1 { font-size: 50px; margin-bottom: 50px; } form { display: inline-block; text-align: left; } .form-group { margin-bottom: 20px; } label { display: block; margin-bottom: 5px; } input[type="text"], input[type="password"] { width: 100%; padding: 10px; font-size: 20px; background-color: #1b1b1b; border: none; color: #fff; } .btn { background-color: #3d3d3d; color: #fff; padding: 10px 20px; border: none; cursor: pointer; transition: background-color 0.5s ease; } .btn:hover { background-color: #ff4500; } ``` JS代码: ``` // 这里可以添加验证登录的逻辑 ``` 以上代码实现了一个简单的赛博朋克风格的登录界面,包括用户名和密码输入框以及登录按钮。您可以根据自己的需要进行修改和完善,例如添加背景图片、特效等等。希望对您有所帮助!
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

宝码香车

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值