html根据状态变换颜色,用事件与CSS改变按钮不同状态下的颜色_html/css_WEB-ITnose

目标效果:

表单的群发按钮,在鼠标悬停时为深蓝色,鼠标离开时为淡蓝色。

HTML代码:

οnmοuseοver="this.className='input_move'" οnmοuseοut="this.className='input_out'" type="submit" tabindex="6">群 发

οnmοuseοver="this.className='input_move'" οnmοuseοut="this.className='input_out'" type="submit" tabindex="6">预 览

CSS代码:

.btn{

color:#ffffff;

background:#44b549;

padding-top:3px;

border-top: 1px solid #44b549;

border-right: 1px solid #44b549;

border-bottom: 1px solid #44b549;

border-left: 1px solid #44b549;

width:100px;

height:30pt;

font-size:15pt;

border-radius:3em;

background-image: linear-gradient(to bottom, #44b549 0px, #44b549 100%);

-moz-border-radius: 5px;

} 注意一定不能少了这一段,此段定义打开页面时按钮的初始样式。若没有这段,页面打开时按钮不显示样式,直至有鼠标悬停。

.input_move{

color:#ffffff;

background:#006600;

padding-top:3px;

border-top: 1px solid #006600;

border-right: 1px solid #006600;

border-bottom: 1px solid #006600;

border-left: 1px solid #006600;

width:100px;

height:30pt;

font-size:15pt;

border-radius:3em;

background-image: linear-gradient(to bottom, #006600 0px, #006600 100%);

-moz-border-radius: 5px;

}

.input_out{

color:#ffffff;

background:#44b549;

padding-top:3px;

border-top: 1px solid #44b549;

border-right: 1px solid #44b549;

border-bottom: 1px solid #44b549;

border-left: 1px solid #44b549;

width:100px;

height:30pt;

font-size:15pt;

border-radius:3em;

background-image: linear-gradient(to bottom, #44b549 0px, #44b549 100%);

-moz-border-radius: 5px;

}

声明:本文原创发布php中文网,转载请注明出处,感谢您的尊重!如有疑问,请联系admin@php.cn处理

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值