当前位置: 首页 > news >正文

CSS动画效果(鼠标滑过按钮动画)

1.整体效果

https://mmbiz.qpic.cn/sz_mmbiz_gif/EGZdlrTDJa5SXiaicFfsrcric7TJmGO6YddqC4wFPdM7PGzPHuFgvtDS7MIvnLHB4WFaKia0Qh8VCyUaoyHMc2Zltg/640?wx_fmt=gif&from=appmsg&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1

网页设计中的按钮不仅是用户交互的桥梁,更是展示创意和技术的平台。酷炫的鼠标经过动画效果能够显著提升按钮的吸引力,激发用户的点击欲望,从而增加用户参与度。本文将介绍几种常用且引人注目的CSS按钮动画效果

2.完整代码

HTML

<!DOCTYPE html>  
<html lang="en">  
<head>  <meta charset="UTF-8">  <title>Title</title>  <link rel="stylesheet" type="text/css" href="6_1.css">  
</head>  
<body>  
<div class="frame">  <button class="custom-btn btn-2">btn02</button>  <button class="custom-btn btn-3"><span>btn03</span></button>  <button class="custom-btn btn-4"><span>btn04</span></button>  <button class="custom-btn btn-5"><span>btn05</span></button>  <button class="custom-btn btn-6"><span>btn06</span></button>  <button class="custom-btn btn-7"><span>btn07</span></button>  <button class="custom-btn btn-8"><span>btn08</span></button>  
</div>  
</body>  
</html>

CSS

body {  background: #e0e5ec;  
}  
h1 {  position: relative;  text-align: center;  color: #353535;  font-size: 50px;  font-family: "Cormorant Garamond", serif;  
}  p {  font-family: 'Lato', sans-serif;  font-weight: 300;  text-align: center;  font-size: 18px;  color: #676767;  
}  
.frame {  width: 50%;  margin: 40px auto;  text-align: center;  
}  
button {  margin: 20px;  
}  
.custom-btn {  width: 130px;  height: 40px;  color: #fff;  border-radius: 5px;  padding: 10px 25px;  font-family: 'Lato', sans-serif;  font-weight: 500;  background: transparent;  cursor: pointer;  transition: all 0.3s ease;  position: relative;  display: inline-block;  box-shadow:inset 2px 2px 2px 0px rgba(125, 111, 111, 0.5),  7px 7px 20px 0px rgba(0,0,0,.1),  4px 4px 5px 0px rgba(0,0,0,.1);  outline: none;  
}  
/* 1 */  /* 2 */  
.btn-2 {  background: rgb(96,9,240);  background: linear-gradient(0deg, rgba(96,9,240,1) 0%, rgba(129,5,240,1) 100%);  border: none;  }  
.btn-2:before {  height: 0%;  width: 2px;  
}  
.btn-2:hover {  box-shadow: 4px 4px 6px 0 rgba(255,255,255,.5),  -4px -4px 6px 0 rgba(116, 125, 136, .5),  inset -4px -4px 6px 0 rgba(255,255,255,.2),  inset 4px 4px 6px 0 rgba(0, 0, 0, .4);  
}  /* 3 */  
.btn-3 {  background: rgb(0,172,238);  background: linear-gradient(0deg, rgba(0,172,238,1) 0%, rgba(2,126,251,1) 100%);  width: 130px;  height: 40px;  line-height: 42px;  padding: 0;  border: none;  }  
.btn-3 span {  position: relative;  display: block;  width: 100%;  height: 100%;  
}  
.btn-3:before,  
.btn-3:after {  position: absolute;  content: "";  right: 0;  top: 0;  background: rgba(2,126,251,1);  transition: all 0.3s ease;  
}  
.btn-3:before {  height: 0%;  width: 2px;  
}  
.btn-3:after {  width: 0%;  height: 2px;  
}  
.btn-3:hover{  background: transparent;  box-shadow: none;  
}  
.btn-3:hover:before {  height: 100%;  
}  
.btn-3:hover:after {  width: 100%;  
}  
.btn-3 span:hover{  color: rgba(2,126,251,1);  
}  
.btn-3 span:before,  
.btn-3 span:after {  position: absolute;  content: "";  left: 0;  bottom: 0;  background: rgba(2,126,251,1);  transition: all 0.3s ease;  
}  
.btn-3 span:before {  width: 2px;  height: 0%;  
}  
.btn-3 span:after {  width: 0%;  height: 2px;  
}  
.btn-3 span:hover:before {  height: 100%;  
}  
.btn-3 span:hover:after {  width: 100%;  
}  /* 4 */  
.btn-4 {  background-color: #4dccc6;  background-image: linear-gradient(315deg, #4dccc6 0%, #96e4df 74%);  line-height: 42px;  padding: 0;  border: none;  
}  
.btn-4:hover{  background-color: #89d8d3;  background-image: linear-gradient(315deg, #89d8d3 0%, #03c8a8 74%);  
}  
.btn-4 span {  position: relative;  display: block;  width: 100%;  height: 100%;  
}  
.btn-4:before,  
.btn-4:after {  position: absolute;  content: "";  right: 0;  top: 0;  box-shadow: 4px 4px 6px 0 rgba(255,255,255,.9),  -4px -4px 6px 0 rgba(116, 125, 136, .2),  inset -4px -4px 6px 0 rgba(255,255,255,.9),  inset 4px 4px 6px 0 rgba(116, 125, 136, .3);  transition: all 0.3s ease;  
}  
.btn-4:before {  height: 0%;  width: .1px;  
}  
.btn-4:after {  width: 0%;  height: .1px;  
}  
.btn-4:hover:before {  height: 100%;  
}  
.btn-4:hover:after {  width: 100%;  
}  
.btn-4 span:before,  
.btn-4 span:after {  position: absolute;  content: "";  left: 0;  bottom: 0;  box-shadow: 4px 4px 6px 0 rgba(255,255,255,.9),  -4px -4px 6px 0 rgba(116, 125, 136, .2),  inset -4px -4px 6px 0 rgba(255,255,255,.9),  inset 4px 4px 6px 0 rgba(116, 125, 136, .3);  transition: all 0.3s ease;  
}  
.btn-4 span:before {  width: .1px;  height: 0%;  
}  
.btn-4 span:after {  width: 0%;  height: .1px;  
}  
.btn-4 span:hover:before {  height: 100%;  
}  
.btn-4 span:hover:after {  width: 100%;  
}  /* 5 */  
.btn-5 {  width: 130px;  height: 40px;  line-height: 42px;  padding: 0;  border: none;  background: rgb(255,27,0);  background: linear-gradient(0deg, rgba(255,27,0,1) 0%, rgba(251,75,2,1) 100%);  
}  
.btn-5:hover {  color: #f0094a;  background: transparent;  box-shadow:none;  
}  
.btn-5:before,  
.btn-5:after{  content:'';  position:absolute;  top:0;  right:0;  height:2px;  width:0;  background: #f0094a;  box-shadow:  -1px -1px 5px 0px #fff,  7px 7px 20px 0px #0003,  4px 4px 5px 0px #0002;  transition:400ms ease all;  
}  
.btn-5:after{  right:inherit;  top:inherit;  left:0;  bottom:0;  
}  
.btn-5:hover:before,  
.btn-5:hover:after{  width:100%;  transition:800ms ease all;  
}  /* 6 */  
.btn-6 {  background: rgb(247,150,192);  background: radial-gradient(circle, rgba(247,150,192,1) 0%, rgba(118,174,241,1) 100%);  line-height: 42px;  padding: 0;  border: none;  
}  
.btn-6 span {  position: relative;  display: block;  width: 100%;  height: 100%;  
}  
.btn-6:before,  
.btn-6:after {  position: absolute;  content: "";  height: 0%;  width: 1px;  box-shadow:  -1px -1px 20px 0px rgba(255,255,255,1),  -4px -4px 5px 0px rgba(255,255,255,1),  7px 7px 20px 0px rgba(0,0,0,.4),  4px 4px 5px 0px rgba(0,0,0,.3);  
}  
.btn-6:before {  right: 0;  top: 0;  transition: all 500ms ease;  
}  
.btn-6:after {  left: 0;  bottom: 0;  transition: all 500ms ease;  
}  
.btn-6:hover{  background: transparent;  color: #76aef1;  box-shadow: none;  
}  
.btn-6:hover:before {  transition: all 500ms ease;  height: 100%;  
}  
.btn-6:hover:after {  transition: all 500ms ease;  height: 100%;  
}  
.btn-6 span:before,  
.btn-6 span:after {  position: absolute;  content: "";  box-shadow:  -1px -1px 20px 0px rgba(255,255,255,1),  -4px -4px 5px 0px rgba(255,255,255,1),  7px 7px 20px 0px rgba(0,0,0,.4),  4px 4px 5px 0px rgba(0,0,0,.3);  
}  
.btn-6 span:before {  left: 0;  top: 0;  width: 0%;  height: .5px;  transition: all 500ms ease;  
}  
.btn-6 span:after {  right: 0;  bottom: 0;  width: 0%;  height: .5px;  transition: all 500ms ease;  
}  
.btn-6 span:hover:before {  width: 100%;  
}  
.btn-6 span:hover:after {  width: 100%;  
}  
/* 7 */  
.btn-7 {  background: linear-gradient(0deg, rgba(255,151,0,1) 0%, rgba(251,75,2,1) 100%);  line-height: 42px;  padding: 0;  border: none;  
}  
.btn-7 span {  position: relative;  display: block;  width: 100%;  height: 100%;  
}  
.btn-7:before,  
.btn-7:after {  position: absolute;  content: "";  right: 0;  bottom: 0;  background: rgba(251,75,2,1);  box-shadow:  -7px -7px 20px 0px rgba(255,255,255,.9),  -4px -4px 5px 0px rgba(255,255,255,.9),  7px 7px 20px 0px rgba(0,0,0,.2),  4px 4px 5px 0px rgba(0,0,0,.3);  transition: all 0.3s ease;  
}  
.btn-7:before{  height: 0%;  width: 2px;  
}  
.btn-7:after {  width: 0%;  height: 2px;  
}  
.btn-7:hover{  color: rgba(251,75,2,1);  background: transparent;  
}  
.btn-7:hover:before {  height: 100%;  
}  
.btn-7:hover:after {  width: 100%;  
}  
.btn-7 span:before,  
.btn-7 span:after {  position: absolute;  content: "";  left: 0;  top: 0;  background: rgba(251,75,2,1);  box-shadow:  -7px -7px 20px 0px rgba(255,255,255,.9),  -4px -4px 5px 0px rgba(255,255,255,.9),  7px 7px 20px 0px rgba(0,0,0,.2),  4px 4px 5px 0px rgba(0,0,0,.3);  transition: all 0.3s ease;  
}  
.btn-7 span:before {  width: 2px;  height: 0%;  
}  
.btn-7 span:after {  height: 2px;  width: 0%;  
}  
.btn-7 span:hover:before {  height: 100%;  
}  
.btn-7 span:hover:after {  width: 100%;  
}  /* 8 */  
.btn-8 {  background-color: #f0ecfc;  background-image: linear-gradient(315deg, #f0ecfc 0%, #c797eb 74%);  line-height: 42px;  padding: 0;  border: none;  
}  
.btn-8 span {  position: relative;  display: block;  width: 100%;  height: 100%;  
}  
.btn-8:before,  
.btn-8:after {  position: absolute;  content: "";  right: 0;  bottom: 0;  background: #c797eb;  /*box-shadow: 4px 4px 6px 0 rgba(255,255,255,.5),  -4px -4px 6px 0 rgba(116, 125, 136, .2),      inset -4px -4px 6px 0 rgba(255,255,255,.5),      inset 4px 4px 6px 0 rgba(116, 125, 136, .3);*/    transition: all 0.3s ease;  
}  
.btn-8:before{  height: 0%;  width: 2px;  
}  
.btn-8:after {  width: 0%;  height: 2px;  
}  
.btn-8:hover:before {  height: 100%;  
}  
.btn-8:hover:after {  width: 100%;  
}  
.btn-8:hover{  background: transparent;  
}  
.btn-8 span:hover{  color: #c797eb;  
}  
.btn-8 span:before,  
.btn-8 span:after {  position: absolute;  content: "";  left: 0;  top: 0;  background: #c797eb;  /*box-shadow: 4px 4px 6px 0 rgba(255,255,255,.5),  -4px -4px 6px 0 rgba(116, 125, 136, .2),      inset -4px -4px 6px 0 rgba(255,255,255,.5),      inset 4px 4px 6px 0 rgba(116, 125, 136, .3);*/    transition: all 0.3s ease;  
}  
.btn-8 span:before {  width: 2px;  height: 0%;  
}  
.btn-8 span:after {  height: 2px;  width: 0%;  
}  
.btn-8 span:hover:before {  height: 100%;  
}  
.btn-8 span:hover:after {  width: 100%;  
}

相关文章:

CSS动画效果(鼠标滑过按钮动画)

1.整体效果 https://mmbiz.qpic.cn/sz_mmbiz_gif/EGZdlrTDJa5SXiaicFfsrcric7TJmGO6YddqC4wFPdM7PGzPHuFgvtDS7MIvnLHB4WFaKia0Qh8VCyUaoyHMc2Zltg/640?wx_fmtgif&fromappmsg&tpwebp&wxfrom5&wx_lazy1&wx_co1 网页设计中的按钮不仅是用户交互的桥梁&#…...

数据结构(C):从初识堆到堆排序的实现

目录 &#x1f31e;0.前言 &#x1f688; 1.堆的概念 &#x1f688; 2.堆的实现 &#x1f69d;2.1堆向下调整算法 &#x1f69d;2.2堆的创建&#xff08;堆向下调整算法&#xff09; ✈️2.2.1 向下调整建堆时间复杂度 &#x1f69d;2.3堆向上调整算法 &#x1f69d;2.…...

ChatGLM3-6B部署

ZhipuAI/chatglm3-6b 模型文件地址 chatglm3-6B-32k-int4 量化的模型地址 ChatGLM3 代码仓库 ChatGLM3 技术文档 cpolar http xxx 端口 /anaconda3/envs/chatglm2/lib/python3.8/site-packages/gradio$ networking.py 硬件环境 最低要求&#xff1a; 为…...

代码随想录35期Day54-JavaScript

Day54题目 ### LeetCode739每日温度 核心思想:今天主要是学会单调栈的使用.找到比元素更大的下一个元素,如果比栈顶元素小就入栈,否则就出栈顶元素,当前元素就是比栈顶元素大的"下一个更大的元素". /*** param {number[]} temperatures* return {number[]}*/ var …...

把自己的服务器添加到presearch节点

Presearch is a scam. Before, judging by the price of the token you should have been able to get between $150-$200 after 12-13 months of regular searches. "If you use this service for the next 11 years you will have earned $30!" Presearch大约需要…...

Open3D(C++) OTSU点云二值化

目录 一、算法原理二、代码实现三、结果展示1、原始点云2、二值化本文由CSDN点云侠原创,原文链接。如果你不是在点云侠的博客中看到该文章,那么此处便是不要脸的爬虫与GPT。 一、算法原理 最大类间方差法(Between-class scatter method)是一种用于分割的方法,它通过计算图…...

浔川python社获得全网博主原力月度排名泸州地区第二名!

今日&#xff0c;浔川python社在查看全网博主原力月度排名泸州地区时&#xff0c;一看就震惊啦&#xff01; 全网博主原力月度排名泸州地区排名榜单 全网博主原力月度排名泸州地区第二名为&#xff1a;浔川python社。 感谢粉丝们的支持&#xff01;浔川python社还会继续努力&a…...

第二站:Java——集合框架的深邃海洋(续)

### Java——集合框架的深邃海洋&#xff08;续&#xff09; 在我们的Java集合框架探索之旅中&#xff0c;我们已经涉足了基本操作、高级特性&#xff0c;现在让我们深入探讨一些特定场景下的应用和进阶技巧&#xff0c;比如集合的分区操作、分组、并行流的性能考量&#xff0…...

linux系统下,mysql增加用户

首先&#xff0c;在linux进入mysql mysql -u root -p 然后查看当前用户&#xff1a; select user,host from user; 增加用户语句&#xff1a; CREATE USER 用户名host范围 IDENTIFIED BY 密码;...

Java数据结构与算法(最长回文子串中心扩散法)

前言 回文子串是练习数据结构和算法比较好的使用场景&#xff0c;可以同时练习到双指针、动态规划等一些列算法。 实现原理 中心扩散算法实现。这里定义最长回文子串长度的大小为maxLen&#xff0c;起点位置为0. 奇数个数为中心点和偶数个数为中心点分别计算回文长度大小。…...

基于Python网络招聘数据可视化分析系统的设计与实现

基于Python网络招聘数据可视化分析系统的设计与实现 Design and Implementation of Python-based Network Recruitment Data Visualization Analysis System 完整下载链接:基于Python网络招聘数据可视化分析系统的设计与实现 文章目录 基于Python网络招聘数据可视化分析系统的…...

【Linux】Linux工具——gcc/g++

1.使用vim更改信用名单——sudo 我们这里来补充sudo的相关知识——添加信任白名单用户 使用sudo就必须将使用sudo的那个账号添加到信用名单里&#xff0c;而且啊&#xff0c;只有超级管理员才可以添加 信用名单在/etc/sudoers里 我们发现它的权限只是可读啊&#xff0c;所以…...

【惯性传感器imu】—— WHEELTEC的惯导模块的imu的驱动安装配置和运行

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 前言一、IMU驱动安装1. 安装依赖2. 源码的下载3. 编译源码(1) 配置固定串口设备(2) 修改luanch文件(3) 编译 二、启动IMU1. 运行imu2. 查看imu数据 总结 前言 WHEE…...

Linux提权一

#信息收集 当前主机的操作系统 hostnamectl cat /etc/*-release lsb_release -a cat /etc/lsb-release # Debain cat /etc/redhat-release # Redhat cat /etc/centos-release # Centos cat /etc/os-release # Ubuntu cat /etc/issue 当前主机的内核版本 hostnamectl uname -a …...

Vue.js中如何实现以列表首列为表头

前言 一般情况table列表的展示&#xff0c;列头都在第一横行&#xff0c;此方法用于列头在第一列的情况。 效果图 核心代码 <template><div><table class"data-table"><tr v-for"(column, columnIndex) in columns" :key"col…...

如果孙宇晨和贾跃亭能够握手,或许将会上演新的戏码

就在贾跃亭宣布将进行个人IP的商业化不久&#xff0c;便迎来了回应&#xff0c;并且这一次给予贾跃亭回应的&#xff0c;同样是一个颇具争议性的人物——孙宇晨。 根据孙宇晨最新发布的视频显示&#xff0c;他愿意投资贾跃亭「做一个新的个人IP化的公司」&#xff0c;并且将会…...

渲染100为什么是高性价比网渲平台?渲染100邀请码1a12

市面上主流的网渲平台有很多&#xff0c;如渲染100、瑞云、炫云、渲云等&#xff0c;这些平台各有特色和优势&#xff0c;也都声称自己性价比高&#xff0c;以渲染100为例&#xff0c;我们来介绍下它的优势有哪些。 1、渲染100对新用户很友好&#xff0c;注册填邀请码1a12有3…...

Jenkins流水线pipeline--基于上一章的工作流程

1流水线部署 1.流水线文本名Jenkinsfile,将流水线放入gitlab远程仓库代码里面 2pipeline脚本 Jenkinsfile文件内容 pipeline {agent anyenvironment {key"value"}stages {stage("拉取git仓库代码") {steps {deleteDir()checkout scmGit(branches: [[nam…...

比较Rust和Haskel

在比较Rust和Haskell时&#xff0c;我们可以从多个维度来分析它们各自的优势。以下是Rust相对于Haskell的优势&#xff0c;以及Haskell相对于Rust的优势&#xff1a; Rust比Haskell强的方面&#xff1a; 内存安全与并发性&#xff1a; Rust通过独特的所有权系统和借用检查器在…...

RedisTemplate的Long类型使用increment自增报错

问题描述 代码如下 Resourceprivate RedisTemplate<String,String > redisTemplate;redisTemplate.opsForValue().set("testKey", 0L); redisTemplate.opsForValue().increment("testKey");工作里用Long类型存储评论数&#xff0c;在使用increment自…...

用docker来安装部署freeswitch记录

今天刚才测试一个callcenter的项目&#xff0c;所以尝试安装freeswitch 1、使用轩辕镜像 - 中国开发者首选的专业 Docker 镜像加速服务平台 编辑下面/etc/docker/daemon.json文件为 {"registry-mirrors": ["https://docker.xuanyuan.me"] }同时可以进入轩…...

是否存在路径(FIFOBB算法)

题目描述 一个具有 n 个顶点e条边的无向图&#xff0c;该图顶点的编号依次为0到n-1且不存在顶点与自身相连的边。请使用FIFOBB算法编写程序&#xff0c;确定是否存在从顶点 source到顶点 destination的路径。 输入 第一行两个整数&#xff0c;分别表示n 和 e 的值&#xff08;1…...

AI书签管理工具开发全记录(十九):嵌入资源处理

1.前言 &#x1f4dd; 在上一篇文章中&#xff0c;我们完成了书签的导入导出功能。本篇文章我们研究如何处理嵌入资源&#xff0c;方便后续将资源打包到一个可执行文件中。 2.embed介绍 &#x1f3af; Go 1.16 引入了革命性的 embed 包&#xff0c;彻底改变了静态资源管理的…...

AspectJ 在 Android 中的完整使用指南

一、环境配置&#xff08;Gradle 7.0 适配&#xff09; 1. 项目级 build.gradle // 注意&#xff1a;沪江插件已停更&#xff0c;推荐官方兼容方案 buildscript {dependencies {classpath org.aspectj:aspectjtools:1.9.9.1 // AspectJ 工具} } 2. 模块级 build.gradle plu…...

R语言速释制剂QBD解决方案之三

本文是《Quality by Design for ANDAs: An Example for Immediate-Release Dosage Forms》第一个处方的R语言解决方案。 第一个处方研究评估原料药粒径分布、MCC/Lactose比例、崩解剂用量对制剂CQAs的影响。 第二处方研究用于理解颗粒外加硬脂酸镁和滑石粉对片剂质量和可生产…...

Java求职者面试指南:计算机基础与源码原理深度解析

Java求职者面试指南&#xff1a;计算机基础与源码原理深度解析 第一轮提问&#xff1a;基础概念问题 1. 请解释什么是进程和线程的区别&#xff1f; 面试官&#xff1a;进程是程序的一次执行过程&#xff0c;是系统进行资源分配和调度的基本单位&#xff1b;而线程是进程中的…...

【JVM】Java虚拟机(二)——垃圾回收

目录 一、如何判断对象可以回收 &#xff08;一&#xff09;引用计数法 &#xff08;二&#xff09;可达性分析算法 二、垃圾回收算法 &#xff08;一&#xff09;标记清除 &#xff08;二&#xff09;标记整理 &#xff08;三&#xff09;复制 &#xff08;四&#xff…...

【学习笔记】erase 删除顺序迭代器后迭代器失效的解决方案

目录 使用 erase 返回值继续迭代使用索引进行遍历 我们知道类似 vector 的顺序迭代器被删除后&#xff0c;迭代器会失效&#xff0c;因为顺序迭代器在内存中是连续存储的&#xff0c;元素删除后&#xff0c;后续元素会前移。 但一些场景中&#xff0c;我们又需要在执行删除操作…...

「全栈技术解析」推客小程序系统开发:从架构设计到裂变增长的完整解决方案

在移动互联网营销竞争白热化的当下&#xff0c;推客小程序系统凭借其裂变传播、精准营销等特性&#xff0c;成为企业抢占市场的利器。本文将深度解析推客小程序系统开发的核心技术与实现路径&#xff0c;助力开发者打造具有市场竞争力的营销工具。​ 一、系统核心功能架构&…...

认识CMake并使用CMake构建自己的第一个项目

1.CMake的作用和优势 跨平台支持&#xff1a;CMake支持多种操作系统和编译器&#xff0c;使用同一份构建配置可以在不同的环境中使用 简化配置&#xff1a;通过CMakeLists.txt文件&#xff0c;用户可以定义项目结构、依赖项、编译选项等&#xff0c;无需手动编写复杂的构建脚本…...