当前位置:网站首页>八种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>
边栏推荐
- f_ Read function [easy to understand]
- Mixed density network (MDN) for multiple regression explanation and code example
- What can NFT metauniverse development do?
- Resolve the format conflict between formatted document and eslint
- This article will help you understand the common concepts, advantages and disadvantages of JWT
- Flutter assembly
- 赫尔辛基交通安全改善项目部署Velodyne Lidar智能基础设施解决方案
- Multiple decorators decorate a function
- [Third Party framework] retrofit2 (1) of network request framework -- Getting Started Guide
- 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
猜你喜欢

Educational administration system development (php+mysql)

说下你对方法区演变过程和内部结构的理解

Stop "outsourcing" Ai models! The latest research finds that some "back doors" that undermine the security of machine learning models cannot be detected

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

面试官:你简历上说精通mysql,那你说下聚簇/联合/覆盖索引、回表、索引下推

iVX低代码平台系列详解 -- 概述篇(一)

Overall MySQL architecture and statement execution process
Create raspberry PI image file of raspberry pie
Introduction to database transactions

Go language - what is critical resource security?
随机推荐
Analysis of the concept of metacosmic system
有哪些新手程序员不知道的小技巧?
Hash table, generic
心樓:華為運動健康的七年築造之旅
Mixed density network (MDN) for multiple regression explanation and code example
Alvaria宣布客户体验行业资深人士Jeff Cotten担任新首席执行官
MySQL installation tutorial
What can NFT metauniverse development do?
GridLayout evenly allocate space
Native JS dynamically add elements
[Third Party framework] retrofit2 (1) of network request framework -- Getting Started Guide
Stop "outsourcing" Ai models! The latest research finds that some "back doors" that undermine the security of machine learning models cannot be detected
The style of the mall can also change a lot. DIY can learn about it!
Day21 multithreading
Common APIs and exception mechanisms
What processes are needed to build a wechat applet from scratch?
Once the code was encrypted by the company's computer, the compilation failed
Data type variable operator
flutter
Reverse series to obtain any wechat applet code