以下是 css3点击按钮发光效果 的示例演示效果:
部分效果截图:
HTML代码(index.html):
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>css3点击按钮发光效果</title>
<script type="text/javascript" charset="UTF-8" src="js/prefixfree.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/base.css" media="all" />
<style type="text/css">
body {
background:#347db0;
text-align: center;
}
.btn-wrap {
text-align: center;
margin: 50px;
}
.btn{
position: relative;
display: inline-block;
line-height: 25px;
padding: 5px 15px;
margin:10px;
transition: all .3s ease-out;
text-transform: uppercase;
border-radius: 5px;
border: 1px solid #1e639a;
color: #fff;
font-weight: bold;
cursor: pointer;
text-shadow:0 1px 2px rgba(0,0,0,.4);
box-shadow: inset 1px 0 0 #559ad5,inset -1px 0 0 #559ad5,inset 0 1px 0 #559ad5,inset 0 -1px 0 #559ad5,0 0 1px rgba(0,0,0,0.5);
background: #4086c2; /* Old browsers */
background: -*-linear-gradient(to bottom, #4086c2 0%,#2989d8 100%,#3378b1 100%);
}
.btn:hover {
background: #3378b1; /* Old browsers */
background: -*-linear-gradient(to bottom, #3378b1 0%,#2989d8 0%,#4086c2 100%);
}
.btn:active:after {
content: "";
display:block;
width: 2px;
height: 2px;
position:absolute;
border-radius:2px;
top:50%;
left: 50%;
margin: -1px 0 0 -1px;
z-index:2;
background: rgba(255,255,255,1);
box-shadow:0 0 10px 5px rgba(255,255,255,0.5),
0 0 20px 10px rgba(255,255,255,0.5),
0 0 30px 15px rgba(255,255,255,0.4),
0 0 40px 20px rgba(255,255,255,0.3),
0 0 50px 25px rgba(255,255,255,0.3),
0 0 60px 30px rgba(255,255,255,0.3),
0 0 70px 35px rgba(255,255,255,0.3);
}​
</style>
</head>
<body>
<div class="page">
<header id="header">
<hgroup class="white">
<h1>css3点击按钮发光效果</h1>
</hgroup>
</header>
<section class="demo">
<div class="btn-wrap">
<button class="btn" type="submit">Submit</button>
<button class="btn" type="reset">Reset</button>
</div>
</section>
</div>
</body>
</html>
CSS代码(base.css):
@charset "utf-8";@import url("http://www.w3cplus.com/download/reset.css");/* ------------------------------------------------- * common * -------------------------------------------------*/
.page{text-align:left;padding-top:40px;}
.wrap_top_nav{background-color:#333;box-shadow:0 1px 3px rgba(0,0,0,0.25),0 -1px 0 rgba(0,0,0,0.1) inset;height:40px;}
#top_nav{width:1000px;margin:0 auto;position:relative;}
#top_nav a{font-size:16px;line-height:40px;float:left;margin-right:20px;color:#999;text-decoration:none;}
#top_nav a:hover{color:#fff;}
#top_nav li:nth-child(1) a{background-image:url(http://www.w3cplus.com/sites/all/themes/marvin/logo.png);background-position:0 -12px;background-repeat:no-repeat;background-size:68px 60px;padding-left:74px;color:#fff;width:74px;overflow:hidden;}
#read{position:absolute;right:0;top:0;font-family:'����';}
#header{text-align:center;}
#header .white{color:#fff;}
#header .blank{color:#444;}
#header h1{font-size:24px;}
#header h2{font-weight:normal;}
#ad_w3cplus{width:750px;margin:100px auto;text-align:center;}
#ad_w3cplus .grid-ad{float:left;}