目标效果:
表单的群发按钮,在鼠标悬停时为深蓝色,鼠标离开时为淡蓝色。
HTML代码:
<button id="submitBtn" class="btn" onmouseover="this.className=‘input_move‘" onmouseout="this.className=‘input_out‘" type="submit" tabindex="6">群 发</button>
<button id="previewBtn" class="btn" onmouseover="this.className=‘input_move‘" onmouseout="this.className=‘input_out‘" type="submit" tabindex="6">预 览</button>
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;
}