如何用css做按钮点击后发光效果怎么做

html-css09

如何用css做按钮点击后发光效果怎么做,第1张

如何用css做按钮点击后发光效果怎么做?

这个问题只能用代码的形式来解答,如下:

http://www.jqueryba.com/jquery/css3buttom.html

.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里的部分加到你的CSS里面

<style>

a.anniu{ display:blockwidth:100pxheight:40pxbackground:url(这里写鼠标不碰的时候的背景图片,不需要的话把这段去掉就可以) no-repeat}

a:hover.anniu{ background:url(这里写鼠标触碰后按钮的背景图片) no-repeat}

</style>

<a class=anniu href=>main</a>

方法/步骤

HTML结构

该鼠标点击按钮特效中每一个可点击的元素都是一个<button>按钮

CSS样式

以下是该css3点击按钮特效的通用CSS样式:

插件中通过在点击按钮时使用javascript来为它添加相应的动画CLASS来执行动画效果:

上面的CSS代码可以生成如下图的动画效果:

在“Stana”效果中,使用了html5 SVG clipPath,在它上面添加了一个transition。这个效果只能在Chrome浏览器中才能看到效果。

在“Stoja”效果中使用了CSS clip-path属性,这个效果也需要浏览器的支持才能看得到的。