当前位置:网站首页>八种button的hover效果
八种button的hover效果
2022-06-25 15:41:00 【七彩冰淇淋与藕汤】
CSS八种hover效果,快用起来_哔哩哔哩_bilibili
以下由于引入了transition所以还需要加兼容性处理:
-ms- :/* IE 9 */
-webkit- :/* Safari 和 Chrome */
-moz- :/* Firefox */
-o- :/* Opera */
<!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>Document</title>
<style>
.btn1{
width: 100px;
height: 40px;
color: #fff;
font-size: 20px;
position: relative;
background-color: skyblue;
border: skyblue;
border-radius: 5px;
text-align: right;
padding-right: 20px;
}
.btn1:hover img{
animation: fly 2s ease 1;
}
@keyframes fly {
0%{
transform: translateX(0);
}
50%{
transform: translateX(100px);
}
100%{
transform: translateX(0);
}
}
.btn1 img{
width: 20px;
position: absolute;
top: 10px;
left: 10px;
}
.btn2{
width: 100px;
height: 40px;
color: skyblue;
font-size: 20px;
background-color: transparent;
border-color: skyblue;
border-radius: 5px;
}
.btn2:hover{
background-color: skyblue;
color: #fff;
border: skyblue;
box-shadow: 0 0 99px 20px skyblue;
}
.btn3{
font-size: 20px;
color:blue;
background: transparent;
border: 0;
text-transform: uppercase;
padding: 10px 20px;
box-sizing: border-box;
position: relative;
}
.btn3::before,.btn3::after{
content:"";
box-sizing:inherit;
border: 2px solid transparent;
width: 0%;
height: 0%;
position: absolute;
}
.btn3::before{
top: 0;
left: 0;
}
.btn3::after{
right: 0;
bottom: 0;
}
.btn3:hover::before{
border-top-color:blue;
border-right-color:blue;
transition: width 0.3s ease-out,height 0.3s ease-out 0.3s;
width: 100%;
height: 100%;
}
.btn3:hover::after{
border-bottom-color:blue;
border-left-color: blue;
transition: width 0.3s ease-out 0.6s,height 0.3s ease-out 0.9s;
width: 100%;
height: 100%;
}
#btn4{
width: 150px;
height: 50px;
background-color: #0597eb;
color: #fff;
font-size: 24px;
text-align: center;
line-height: 50px;
border-radius: 25px;
overflow: hidden;
position: relative;
}
#btn4 .sp{
position: absolute;
z-index: 9;
color: red;
}
#btn4::before{
position: absolute;
top: 0;
left: 0;
content: "";
z-index: 0;
width: 0px;
height: 100%;
transition: all 2s ease;
-webkit-transition:all 2s ease;
background-color: #aa00aa;
}
#btn4:hover::before{
width: 200px;
height: 50px;
}
#arrow{
position: absolute;
background-color: #aa00aa;
width: 50px;
height: 50px;
border-radius: 25px;
float: left;
z-index: 9;
}
#arrow span{
float: left;
color: #fff;
}
.btn-container{
position: relative;
}
.btn5{
border: 0;
border-radius: 50px;
color: #fff;
background-color: #5f55af;
padding: 15px 20px 15px 60px;
text-transform: uppercase;
background: linear-gradient(to right,#f72585 50%,#5f55af 50%);
background-size: 200% 100%;
background-position: right bottom;
/* 如果加在 :hover后面,鼠标移出会没有效果 */
transition: all 2s ease;
}
.btn-container span{
background-color: #f72585;
height: 100%;
width: 46px;
position: absolute;
left: 0;
top: 0;
border-radius: 50%;
}
button:hover{
background-position: left bottom;
}
.btn6{
color: #fff;
border: 0;
background-color: #18a6b8;
width: 200px;
height: 50px;
font-size: 24px;
border-radius:10px;
transition: all 2s ease;
}
.btn6:hover{
border-top-left-radius: 50px;
border-bottom-right-radius: 50px;
}
.btn7{
width: 200px;
height: 50px;
background: linear-gradient(to right ,#25aae1,#40e495);
border: 0;
font-size: 24px;
color: #fff;
position: relative;
border-radius: 50px;
overflow: hidden;
}
.btn7::before{
content: "";
width: 0px;
height: 100%;
position: absolute;
top: 0;
left: 0;
background-color: rgba(255,255,255,0.5);
transition:all 2s ease;
}
.btn7:hover::before{
width: 200px;
}
.btn8{
padding: 0;
width: 200px;
height: 50px;;
border: 2px solid #fff;
font-size: 24px;
color: #fff;
background-color: #1B2543;
transition: all 1s ease;
position: relative;
box-sizing: content-box;
overflow: hidden;
}
.btn8::before{
content:'';
width: 20px;
height: 50px;
background-color: rgba(255, 255, 255, 0.1);
transform: skewX(45deg);
transform-origin:0%,0%;
position: absolute;
top: 0px;
left: -45px;
}
.btn8:hover::before{
left: 225px;
transition: all 0.5s linear;
}
.btn9{
width: 200px;
height: 50px;
border: 0;
font-size: 24px;
color: #000;
font-weight: 600;
background:linear-gradient(to right ,#FF765D 50%,#fff 50%);
background-size: 200% 100%;
background-position: right bottom;
transition: all 1s ease;
}
.btn9:hover{
background-position: left bottom;
}
</style>
</head>
<body>
<div id="d1">
<button class="btn1"><img src="flay.webp" alt="纸飞机"> 按钮1 </button>
<button class="btn2">按钮2</button>
<button class="btn3">Hover Me</button>
<div id="btn4"><div id="arrow"><span>-></span></div><span class="sp">Hover Me</span></div>
<div class="btn-container"><span>-></span><button class="btn5">Hover Me</button></div></button>
<button class="btn6">Hover Me</button>
<button class="btn7">Hover Me</button>
<button class="btn8">Hover Me</button>
<button class="btn9">Hover Me</button>
</div>
</body>
</html>
边栏推荐
- Dart syntax
- What plug-ins are available for vscade?
- 心楼:华为运动健康的七年筑造之旅
- Overall MySQL architecture and statement execution process
- Most commonly used SQL statements
- ES6 deconstruction assignment rename
- User registration, information writing to file
- XML usage and parsing of data storage and transmission files
- Function and implementation of closures
- Error: homebrew core is a shallow clone
猜你喜欢

Detailed explanation of IVX low code platform series -- Overview (I)

Vscode有什么好用的插件?
Check whether the port number is occupied

Lecun predicts AgI: big model and reinforcement learning are both ramps! My "world model" is the new way

读配置、讲原理、看面试真题,我只能帮你到这了。。。

赫尔辛基交通安全改善项目部署Velodyne Lidar智能基础设施解决方案

商城风格也可以很多变,DIY了解一下!

Describe your understanding of the evolution process and internal structure of the method area

Linux-MySQL数据库之高级SQL 语句一

不要小看了积分商城,它的作用可以很大!
随机推荐
Blue Bridge Cup - practice system login
数字经济时代文化消费新特征
Tensorflow loading cifar10 dataset
10 Super VIM plug-ins, I can't put them down
Alvaria宣布客户体验行业资深人士Jeff Cotten担任新首席执行官
iVX低代码平台系列详解 -- 概述篇(一)
Day21 multithreading
[Third Party framework] retrofit2 (1) of network request framework -- Getting Started Guide
Principle analysis of ThreadLocal source code
Leetcode topic [array]-34- find the first and last positions of elements in a sorted array
Servlet details
When inputting text in the shutter textfield, if the page is refreshed, the cursor position will change.
Interviewer: your resume says you are proficient in mysql, so you say cluster / Union / overlay index, table return, index push down
Xinlou: Huawei's seven-year building journey of sports health
Check whether the port number is occupied
Resolve the format conflict between formatted document and eslint
Based on neural tag search, the multilingual abstracts of zero samples of Chinese Academy of Sciences and Microsoft Asiatic research were selected into ACL 2022
The style of the mall can also change a lot. DIY can learn about it!
Read the configuration, explain the principle and read the interview questions. I can only help you here...
炮打司令部,别让一个UI框架把你毁了