css实现70款不同风格鼠标悬浮按钮动画效果代码

代码语言:html

所属分类:悬停

代码描述:css实现70款不同风格鼠标悬浮按钮动画效果代码

代码标签: css 悬浮 按钮 动画

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum=1.0,minimum=1.0,user-scalable=0" />
    <style>
        @import url(css.css);
    body {
    	background: #fff;
    	font-family: 'Roboto', sans-serif;
    	font-weight: 400;
    }
    .buttons {
    	width: 100%;
    	float: left;
    }
    .container_odd {
    	width: 100%;
    	padding:50px 0;
    	float: left;
    	background:#f0f0f0;
    }
    .container_even {
    	width: 100%;
    	float: left;
    	padding:50px 0;
    	background:#fff;
    }
    h1 {
    	color: #333;
    	font-size: 2.5em;
    	font-weight: 400;
    	margin: 30px 0 10px 0;
    	text-align:center;
    }
    h3 {
    	color: #333;
    	font-size: 1.5em;
    	font-weight: 400;
    	margin: 1.50em 0 1em 0;
    	text-align: left;
    	border-bottom: 1px solid rgba(255,255,255, 0.1);
    	padding-bottom: 20px;
    }
    h4 {
    	color: #666;
    	font-size: 1.5em;
    	font-weight: 100;
    	margin:0px 0 40px 0;
    	text-align:center;
    }
    .set_container {
    	width: 1000px;
    	margin: auto;
    	padding-bottom:0px;
    	clear: both;
    }
    
.set_1_btn {
	color: #333;
	cursor: pointer;
	display: block;
	font-size: 16px;
	font-weight: 400;
	line-height: 45px;
	margin-right: 2em;
	text-align: center;
	max-width: 160px;
	position: relative;
	text-decoration: none;
	text-transform: uppercase;
	vertical-align: middle;
	width: 100%;
}
.set_1_btn:hover {
	text-decoration: none;
}
.Vbtn-1 {
	background:transparent;
	text-align: center;
	float:left;
}
.Vbtn-1 svg {
	height: 45px;
	left: 0;
	position: absolute;
	top: 0;
	width: 100%;
}
.Vbtn-1 rect {
	fill: none;
	stroke: #e1b700;
	stroke-width: 3;
	stroke-dasharray: 422, 0;
	transition: all 450ms linear 0s;
}
.Vbtn-1:hover {
	background: rgba(225, 51, 45, 0);
	font-weight: 900;
	letter-spacing: 1px;
	transition: all 150ms linear 0s;
}
.Vbtn-1:hover rect {
	stroke-width: 5;
	stroke-dasharray: 15, 310;
	stroke-dashoffset: 48;
	-webkit-transition: all 1.35s cubic-bezier(0.19, 1, 0.22, 1);
	transition: all 1.35s cubic-bezier(0.19, 1, 0.22, 1);
}
.Vbtn-2 {
	letter-spacing: 0;
	transition: all 150ms linear 0s;
	float:left;
}
.Vbtn-2:hover, .Vbtn-2:active {
	letter-spacing: 5px;
	transition: all 150ms linear 0s;
}
.Vbtn-2:after, .Vbtn-2:before {
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	border: 1px solid rgba(255, 255, 255, 0);
	bottom: 0px;
	content: " ";
	display: block;
	margin: 0 auto;
	position: relative;
	-webkit-transition: all 280ms ease-in-out;
	transition: all 280ms ease-in-out;
	width: 0;
}
.Vbtn-2:hover:after, .Vbtn-2:hover:before {
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	border-color: #56c5ff;
	-webkit-transition: width 350ms ease-in-out;
	transition: width 350ms ease-in-out;
	width: 70%;
}
.Vbtn-2:hover:before {
	bottom: auto;
	top: 0;
	width: 70%;
}


.Vbtn-3 {
	background:transparent;
	text-align: center;
	float:left;
}
.Vbtn-3 svg {
	height: 45px;
	left: 0;
	position: absolute;
	top: 0;
	width: 100%;
}
.Vbtn-3 rect {
	fill: none;
	stroke: #f2625a;
	stroke-width: 3;
	stroke-dasharray: 422, 0;
	transition: all 450ms linear 0s;	
}
.Vbtn-3:hover {
	background: rgba(225, 51, 45, 0);
	font-weight: 900;
	letter-spacing: 1px;
	transition: all 150ms linear 0s;
}
.Vbtn-3:hover rect {
	stroke-width: 5;
	stroke-dasharray: 15, 310;
	stroke-dashoffset: 48;
	-webkit-transition: all 1.35s cubic-bezier(0.19, 1, 0.22, 1);
	transition: all 1.35s cubic-bezier(0.19, 1, 0.22, 1);
}

.Vbtn-4 {
	letter-spacing: 0;
	transition: all 150ms linear 0s;
	float:left;
}
.Vbtn-4:hover, .Vbtn-4:active {
	letter-spacing: 5px;
	transition: all 150ms linear 0s;
}
.Vbtn-4:after, .Vbtn-4:before {
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	border: 1px solid rgba(255, 255, 255, 0);
	bottom: 0px;
	content: " ";
	display: block;
	margin: 0 auto;
	position: relative;
	-webkit-transition: all 280ms ease-in-out;
	transition: all 280ms ease-in-out;
	width: 0;
}
.Vbtn-4:hover:after, .Vbtn-4:hover:before {
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	border-color: #666;
	-webkit-transition: width 350ms ease-in-out;
	transition: width 350ms ease-in-out;
	width: 70%;
}
.Vbtn-4:hover:before {
	bottom: auto;
	top: 0;
	width: 70%;
}

/*  set2 start here */

.set_2_button {
	font: inherit;
	color: #FFF;
	width: auto;
	float: left;
	padding: 0px 25px;
	line-height: 45px;
	margin-right: 2.5em;
	overflow: hidden;
	position: relative;
	transition: all 1s;
	cursor: pointer;
}
.set_2_button:before {
	left: 48%;
}
.set_2_button:active {
	background: #cccccc;
	color: #000000;
	top: 2px;
	transition: all 1s;
}
.set_2_button > span {
	display: inline-block;
	transition: all 0.5s;
}
.icon-forward:before {
	content: "→";
	position: absolute;
}
.icon-backward:before {
	content: "←";
	position: absolute;
}
.icon-up:before {
	content: "↑";
	position: absolute;
}
.icon-down:before {
	content: "↓";
	position: absolute;
}
.set_2_btn-1:before {
	left: -100%;
	transition: all 0.5s;
}
.set_2_btn-1:hover:before {
	left: 48%;
	transition: all 1s;
}
.set_2_btn-1:hover > span {
	transform: translateX(300%);
	transition: all 1s;
}
.set_2_btn-2:before {
	top: -100%;
	transition: all 0.5s;
}
.set_2_btn-2:hover:before {
	top: 0px;
}
.set_2_btn-2:hover > span {
	transform: translateY(300%);
}
.color1{
background:#666666 ;
}
.color2{
background:#f8c013;
color:#2e2302;
}
.color3{
background:#f2625a;
}
.color4{
background:#b9ccd2;
color:#252b2d;
}
.color5{
background:#56c5ff;
color:#fff;
}

/* set 2 end here */
.set_3_button {
	color: rgba(255,255,255,1);
	-webkit-transition: all 0.5s;
	-moz-transition: all 0.5s;
	-o-transition: all 0.5s;
	transition: all 0.5s;
	position: relative;
	background:#666666;
	overflow: hidden;
	width: auto;
	padding: 0px 25px;
	margin-right: 2.5em;
	line-height: 45px;
	float: left;
	cursor: pointer;
	text-align: center;
}
.set_3_button a {
	color: rgba(51,51,51,1);
	text-decoration: none;
	display: block;
}
.set_3_button span {
	-webkit-transition: all 0.3s;
	-moz-transition: all 0.3s;
	-o-transition: all 0.3s;
	transition: all 0.3s;
}
.set_3_button:hover {
	background-color: rgba(0,0,0,0.3);
}
.set_3_button:hover > span {
	opacity: 0;
	-webkit-transform: translate(0px, 40px);
	transform: translate(0px, 40px);
}
.set_3_button::after {
	content: attr(data-text);
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	opacity: 0;
	-webkit-transform: translate(-30%, 0);
	transform: translate(-30%, 0);
	-webkit-transition: all 0.3s;
	-moz-transition: all 0.3s;
	-o-transition: all 0.3s;
	transition: all 0.3s;
}
.set_3_button:hover::after {
	opacity: 1;
	-webkit-transform: translate(0, 0);
	transform: translate(0, 0);
}
/************************************/



.set_3_button2 {
	color:#2e2302;
	-webkit-transition: all 0.5s;
	-moz-transition: all 0.5s;
	-o-transition: all 0.5s;
	transition: all 0.5s;
	position: relative;
	background:#e1b700;
	overflow: hidden;
	width: auto;
	padding: 0px 25px;
	margin-right: 2.5em;
	line-height: 45px;
	float: left;
	cursor: pointer;
	text-align: center;
}
.set_3_button2 a {
	color: rgba(51,51,51,1);
	text-decoration: none;
	display: block;
}
.set_3_button2 span {
	-webkit-transition: all 0.3s;
	-moz-transition: all 0.3s;
	-o-transition: all 0.3s;
	transition: all 0.3s;
}
.set_3_button2:hover {
	background-color:#ffd311;
}
.set_3_button2:hover > span {
	opacity: 0;
	-webkit-transform: translate(0px, -40px);
	transform: translate(0px, -40px);
}
.set_3_button2::after {
	content: attr(data-text);
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	opacity: 0;
	-webkit-transform: translate(0, 30%);
	transform: translate(0, 30%);
	-webkit-transition: all 0.3s;
	-moz-transition: all 0.3s;
	-o-transition: all 0.3s;
	transition: all 0.3s;
}
.set_3_button2:hover::after {
	opacity: 1;
	-webkit-transform: translate(0, 0);
	transform: translate(0, 0);
}
/**********************************/

.set_3_button3 {
	color: rgba(255,255,255,1);
	-webkit-transition: all 0.5s;
	-moz-transition: all 0.5s;
	-o-transition: all 0.5s;
	transition: all 0.5s;
	position: relative;
	background:#f2625a;
	overflow: hidden;
	width: auto;
	padding: 0px 25px;
	margin-right: 2.5em;
	line-height: 45px;
	float: left;
	cursor: pointer;
	text-align: center;
}
.set_3_button3 a {
	color: rgba(51,51,51,1);
	text-decoration: none;
	display: block;
}
.set_3_button3 span {
	-webkit-transition: all 0.3s;
	-moz-transition: all 0.3s;
	-o-transition: all 0.3s;
	transition: all 0.3s;
}
.set_3_button3:hover {
	background-color:#dd483f;
}
.set_3_button3:hover > span {
	opacity: 0;
	-webkit-transform: translate(0px, 40px);
	transform: translate(0px, 40px);
}
.set_3_button3::after {
	content: attr(data-text);
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	opacity: 0;
	-webkit-transform: translate(30%, 0);
	transform: translate(30%, 0);
	-webkit-transition: all 0.3s;
	-moz-transition: all 0.3s;
	-o-transition: all 0.3s;
	transition: all 0.3s;
}
.set_3_button3:hover::after {
	opacity: 1;
	-webkit-transform: translate(0, 0);
	transform: translate(0, 0);
}
/***********************************/


.set_3_button4 {
	color:#252b2d;
	-webkit-transition: all 0.5s;
	-moz-transition: all 0.5s;
	-o-transition: all 0.5s;
	transition: all 0.5s;
	position: relative;
	background:#b9ccd2 ;
	overflow: hidden;
	width: auto;
	padding: 0px 25px;
	margin-right: 2.5em;
	line-height: 45px;
	float: left;
	cursor: pointer;
	text-align: center;
}
.set_3_button4 a {
	color:#252b2d;
	text-decoration: none;
	display: block;
}
.set_3_button4 span {
	-webkit-transition: all 0.3s;
	-moz-transition: all 0.3s;
	-o-transition: all 0.3s;
	transition: all 0.3s;
}
.set_3_button4:hover {
	background-color: #cce0e7;
}
.set_3_button4:hover > span {
	opacity: 0;
	-webkit-transform: translate(0px, -40px);
	transform: translate(0px, -40px);
}
.set_3_button4::after {
	content: attr(data-text);
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	opacity: 0;
	-webkit-transform: translate(0, -30%);
	transform: translate(0, -30%);
	-webkit-transition: all 0.3s;
	-moz-transition: all 0.3s;
	-o-transition: all 0.3s;
	transition: all 0.3s;
}
.set_3_button4:hover::after {
	opacity: 1;
	-webkit-transform: translate(0, 0);
	transform: translate(0, 0);
}




.set_4_button1 {
  position: relative;
  font-weight: 400;
  text-align: center;
  width: auto;
  float:left;
  padding:0 25px;
  line-height:45px;
  border:1px solid #fff;
  overflow: hidden;
  position: relative;
  z-index: 0;
  cursor: pointer;
  color:#FFF;
  margin-right: 2.5em;
}
.set_4_button1.raised {
  -moz-transition: all 0.1s;
  -o-transition: all 0.1s;
  -webkit-transition: all 0.1s;
  transition: all 0.1s;
  background: #666666;
}
.set_4_button1.raised:active {
  background: #0c7dd8;
  box-shadow: 0px 1px 1px #063e6b;
}
.anim {
  -moz-transform: translateY(-50%) translateX(-50%);
  -ms-transform: translateY(-50%) translateX(-50%);
  -webkit-transform: translateY(-50%) translateX(-50%);
  transform: translateY(-50%) translateX(-50%);
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: -1;
}
.anim:before {
  position: relative;
  content: '';
  display: block;
  margin-top: 100%;
}
.anim:after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  border-radius: 50%;
}

.clickable .toggle:checked + .anim {
  -moz-animation: anim-in 0.75s;
  -webkit-animation: anim-in 0.75s;
  animation: anim-in 0.75s;
}
.clickable .toggle:checked + .anim:after {
  -moz-animation: anim-in-pseudo 0.75s;
  -webkit-animation: anim-in-pseudo 0.75s;
  animation: anim-in-pseudo 0.75s;
}
.clickable .toggle:not(:checked) + .anim {
  -moz-animation: anim-out 0.75s;
  -webkit-animation: anim-out 0.75s;
  animation: anim-out 0.75s;
}
.clickable .toggle:not(:checked) + .anim:after {
  -moz-animation: anim-out-pseudo 0.75s;
  -webkit-animation: anim-out-pseudo 0.75s;
  animation: anim-out-pseudo 0.75s;
}

.hoverable:hover > .anim {
  -moz-animation: anim-out 0.75s;
  -webkit-animation: anim-out 0.75s;
  animation: anim-out 0.75s;
}
.hoverable:hover > .anim:after {
  -moz-animation: anim-out-pseudo 0.75s;
  -webkit-animation: anim-out-pseudo 0.75s;
  animation: anim-out-pseudo 0.75s;
}
@-webkit-keyframes anim-in {
  0% {
    width: 0%;
  }
  100% {
    width: 100%;
  }
}
@-moz-keyframes anim-in {
  0% {
    width: 0%;
  }
  100% {
    width: 100%;
  }
}
@-ms-keyframes anim-in {
  0% {
    width: 0%;
  }
  100% {
    width: 100%;
  }
}
@keyframes anim-in {
  0% {
    width: 0%;
  }
  100% {
    width: 100%;
  }
}
@-webkit-keyframes anim-in-pseudo {
  0% {
    background: rgba(0, 0, 0, 0.25);
  }
  100% {
    background: transparent;
  }
}
@-moz-keyframes anim-in-pseudo {
  0% {
    background: rgba(0, 0, 0, 0.25);
  }
  100% {
    background: transparent;
  }
}
@-ms-keyframes anim-in-pseudo {
  0% {
    background: rgba(0, 0, 0, 0.25);
  }
  100% {
    background: transparent;
  }
}
@keyframes anim-in-pseudo {
  0% {
    background: rgba(0, 0, 0, 0.25);
  }
  100% {
    background: transparent;
  }
}
@-webkit-keyframes anim-out {
  0% {
    width: 0%;
  }
  100% {
    width: 100%;
  }
}
@-moz-keyframes anim-out {
  0% {
    width: 0%;
  }
  100% {
    width: 100%;
  }
}
@-ms-keyframes anim-out {
  0% {
    width: 0%;
  }
  100% {
    width: 100%;
  }
}
@keyframes anim-out {
  0% {
    width: 0%;
  }
  100% {
    width: 100%;
  }
}
@-webkit-keyframes anim-out-pseudo {
  0% {
    background: rgba(0, 0, 0, 0.25);
  }
  100% {
    background: transparent;
  }
}
@-moz-keyframes anim-out-pseudo {
  0% {
    background: rgba(0, 0, 0, 0.25);
  }
  100% {
    background: transparent;
  }
}
@-ms-keyframes anim-out-pseudo {
  0% {
    background: rgba(0, 0, 0, 0.25);
  }
  100% {
    background: transparent;
  }
}
@keyframes anim-out-pseudo {
  0% {
    background: rgba(0, 0, 0, 0.25);
  }
  100% {
    background: transparent;
  }
}



.color1{
background:#666666 ;
}
.color2{
background:#f8c013;
color:#2e2302;
}
.color3{
background:#f2625a;
}
.color4{
background:#b9ccd2;
color:#252b2d;
}
.color5{
background:#56c5ff;
color:#fff;
}
.set_4_button1 {
  position: relative;
  font-weight: 400;
  text-align: center;
  width: auto;
  float:left;
  padding:0 25px;
  line-height:45px;
  border:1px solid #fff;
  overflow: hidden;
  position: rela.........完整代码请登录后点击上方下载按钮下载查看

网友评论0