DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> WEB網站前端 >> 網頁特效代碼 >> htbtn.css多種CSS3按鈕炫酷樣式光標懸浮動畫
htbtn.css多種CSS3按鈕炫酷樣式光標懸浮動畫
編輯:網頁特效代碼     
一共提供5中樣式,有閃光,有邊框變幻。

只能說樣式確實很酷,還是親自試試效果吧。

查看效果

使用方法:
先引用css文件htbtn.css:
<link rel="stylesheet" type="text/css" href="http://hovertree.com/texiao/css3/28/css/htbtn.css">

然後外層加類htcontainer,按鈕加類htbtn,再加類htbtn-1或者htbtn-2等,一共5種,
如果是htbtn-1的話,多加一個svg元素

html代碼:
<div class="htcontainer">        
<a href="http://hovertree.com/" class="htbtn htbtn-1">
<svg>
<rect x="0" y="0" fill="none" width="100%" height="100%" />
</svg>
光標懸浮
</a>

<a href="http://hovertree.com/h/bjaf/4slmqpp2.htm" class="htbtn htbtn-2">何問起</a>
</div>


完整代碼如下:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>使用htbtn.css制作按鈕動畫_何問起</title><base target="_blank" />
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="http://hovertree.com/texiao/css3/28/css/htbtn.css">
<style>
.hovertreeinfo{text-align:center;}
</style>
</head>
<body>
<div class="hovertreeinfo"><h1>使用htbtn.css制作按鈕動畫</h1>
請把光標懸浮到各個按鈕上面。
</div>
<div class="htcontainer">
<a href="http://hovertree.com/" class="htbtn htbtn-1">
<svg>
<rect x="0" y="0" fill="none" width="100%" height="100%" />
</svg>
光標懸浮
</a>

<a href="http://hovertree.com/h/bjaf/4slmqpp2.htm" class="htbtn htbtn-2">何問起</a>

<a href="http://hovertree.com/h/bjaf/j6fv3btp.htm" class="htbtn htbtn-3">htbtn-3 凹凸</a>

<a href="http://hovertree.com/h/bjaf/0guusq6s.htm" class="htbtn htbtn-4"><span>htbtn-4 閃電</span></a>

<a href="http://hovertree.com/h/bjaf/kqud99m6.htm" class="htbtn htbtn-5">何問起邊框</a>

</div>
</body>
</html>


Demo 2效果展示:

效果展示

Demo 2代碼如下:
<!doctype html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>5種純CSS3鼠標滑過按鈕動畫特效_何問起</title><base target="_blank" />
<link rel='stylesheet prefetch' href='http://hovertree.com/texiao/css3/28/css/reset.css'>
<link rel="stylesheet" type="text/css" href="http://hovertree.com/texiao/css3/28/css/default.css">

<!--必要樣式-->
<link rel="stylesheet" type="text/css" href="http://hovertree.com/texiao/css3/28/css/styles.css">
<!--[if IE]>
<script src="http://hovertree.com/texiao/html5/4/html5shiv.min.js"></script>
<![endif]-->
</head>
<body>

<section class="buttons">

<div class="container">
<h1>Button Hover Effects</h1>

<a href="http://hovertree.com/" class="btn btn-1">
<svg>
<rect x="0" y="0" fill="none" width="100%" height="100%" />
</svg>
Hover
</a>
<!--End of Button 1 -->

<a href="http://hovertree.com/h/bjaf/4slmqpp2.htm" class="btn btn-2">Hover</a>
<!--End of Button 2 -->

<a href="http://hovertree.com/h/bjaf/j6fv3btp.htm" class="btn btn-3">Hover</a>
<!--End of Button 3 -->

<a href="http://hovertree.com/h/bjaf/0guusq6s.htm" class="btn btn-4"><span>Hover</span></a>
<!--End of Button 4 -->

<a href="http://hovertree.com/h/bjaf/kqud99m6.htm" class="btn btn-5">Hover</a>
<!--End of Button 5 -->

</div>

</section>
</body>
</html>


最後放上htbtn.css文件的代碼:
/*
htbtn.css
按鈕動畫樣式

by 何問起
hovertree.com

ht 表示 HoverTree
*/

.htcontainer {
padding: 1em;
background-color:#E1332D;
margin:0px;
text-align:center;
}
.htcontainer a{color:#ffffff}
.htbtn {
color: #fff;
cursor: pointer;
display: block;
font-size: 16px;
font-weight: 400;
line-height: 45px;
margin: 0 auto 0em;
max-width: 160px;
position: relative;
text-decoration: none;
text-transform: uppercase;
vertical-align: middle;
width: 100%;
text-align:center;
font-family:Arial, 'Microsoft YaHei',Helvetica, sans-serif
}
@media (min-width: 400px) {
.htbtn {
display: inline-block;
margin-right: 2.5em;
}
.htbtn:nth-of-type(even) {
margin-right: 0;
}
}
@media (min-width: 600px) {
.htbtn:nth-of-type(even) {
margin-right: 2.5em;
}
.htbtn:nth-of-type(5) {
margin-right: 0;
}
}
.htbtn:hover {
text-decoration: none;
}

.htbtn-1 {
background: #e02c26;
font-weight: 100;
}
.htbtn-1 svg {
height: 45px;
left: 0;
position: absolute;
top: 0;
width: 100%;
}
.htbtn-1 rect {
fill: none;
stroke: #fff;
stroke-width: 2;
stroke-dasharray: 422, 0;
}

.htbtn-1:hover {
background: rgba(225, 51, 45, 0);
font-weight: 900;
letter-spacing: 1px;
}
.htbtn-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);
}

.htbtn-2 {
letter-spacing: 0;
}

.htbtn-2:hover,
.htbtn-2:active {
letter-spacing: 5px;
}

.htbtn-2:after,
.htbtn-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;
}

.htbtn-2:hover:after,
.htbtn-2:hover:before {
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
border-color: #fff;
-webkit-transition: width 350ms ease-in-out;
transition: width 350ms ease-in-out;
width: 70%;
}

.htbtn-2:hover:before {
bottom: auto;
top: 0;
width: 70%;
}

.htbtn-3 {
background: #e3403a;
border: 1px solid #da251f;
box-shadow: 0px 2px 0 #d6251f, 2px 4px 6px #e02a24;
font-weight: 900;
letter-spacing: 1px;
-webkit-transition: all 150ms linear;
transition: all 150ms linear;

}

.htbtn-3:hover {
background: #e02c26;
border: 1px solid rgba(0, 0, 0, 0.05);
box-shadow: 1px 1px 2px rgba(255, 255, 255, 0.2);
color: #ec817d;
text-decoration: none;
text-shadow: -1px -1px 0 #c2211c;
-webkit-transition: all 250ms linear;
transition: all 250ms linear;
}

.htbtn-4 {
border: 1px solid;
overflow: hidden;
position: relative;
}
.htbtn-4 span {
z-index: 20;
}
.htbtn-4:after {
background: #ffffff;
content: " ";
height: 155px;
left: -75px;
opacity: 0.2;
position: absolute;
top: -50px;
-webkit-transform: rotate(35deg);
-ms-transform: rotate(35deg);
transform: rotate(35deg);
-webkit-transition: all 550ms cubic-bezier(0.19, 1, 0.22, 1);
transition: all 550ms cubic-bezier(0.19, 1, 0.22, 1);
width: 50px;
z-index: 10;
}

.htbtn-4:hover:after {
left: 120%;
-webkit-transition: all 550ms cubic-bezier(0.19, 1, 0.22, 1);
transition: all 550ms cubic-bezier(0.19, 1, 0.22, 1);
}

.htbtn-5 {
border: 0 solid;
box-shadow: inset 0 0 20px rgba(255, 255, 255, 0);
outline: 1px solid;
outline-color: rgba(255, 255, 255, 0.5);
outline-offset: 0px;
text-shadow: none;
-webkit-transition: all 1250ms cubic-bezier(0.19, 1, 0.22, 1);
transition: all 1250ms cubic-bezier(0.19, 1, 0.22, 1);
}

.htbtn-5:hover {
border: 1px solid;
box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.5), 0 0 20px rgba(255, 255, 255, 0.2);
outline-color: rgba(255, 255, 255, 0);
outline-offset: 15px;
text-shadow: 1px 1px 2px #427388;
}
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved