Dreamweaver FrontPage HTML/CSS Javascript 
Google adsense申请技巧本站核心代理域名注册主机业务 快速发布你的买卖域名买卖网站信息 1元注册 cn域名
站长每日新闻导读 √ ·推荐万网空间¥120元 150m 站长网:站长必上的网站网站联盟大全本站代理万网域名55空间120元
 2007-6-11 10:39:33

CSS制作带有样式的网页按钮

来源: 字体:[ ]

    今天把按钮部分重新设计了下,原先他使用的JS实现图片交替变化的方式,但那样的缺点是:占用了input里的ID属性,而且disabled也不能使用,不利于程序的设计制作。
 
    按钮重新制作的思想:

    1、实现触发与不触发之间的差别;
    2、适用input和a;
    3、多种浏览器下无差别。

    按钮重新制作的过程:

    1、利用不同样式实现触发与不触发之间的差别;
    2、利用boder来模拟按钮阴影

    以下代码在IE6、IE7、FF下测试正常!

CSS部分:

.button-style01{
 color:#5E7384;
 font-weight: bold;
 background:#CBDBE5;
 border-top:1px solid #f1f1f1;
 border-left:1px solid #f1f1f1;
 border-right:2px solid #666;
 border-bottom:2px solid #666;
 height: 25px
}

.button-style02{
 color:#fff;
 font-weight: bold;
 background: #859BAB;
 border:1px solid #f1f1f1;
 border-top:1px solid #f1f1f1;
 border-left:1px solid #f1f1f1;
 border-right:2px solid #666;
 border-bottom:2px solid #666;
 height: 25px
}

a.button-style01,a.button-style02 {
 display:block;
 height:22px;
 line-height:22px;
 vertical-align:middle;
 padding:0px 8px;
}

a.button-style01:link,a.button-style01:visited {
 text-decoration:none;
 color:#5E7384;
 border-top:1px solid #f1f1f1;
 border-left:1px solid #f1f1f1;
 border-right:2px solid #666;
 border-bottom:2px solid #666;
}
 
a.button-style02:hover,a.button-style02:active {
 text-decoration:none;
 color:#fff;
 border-top:1px solid #f1f1f1;
 border-left:1px solid #f1f1f1;
 border-right:2px solid #333;
 border-bottom:2px solid #333;
}

xhtml部分:
<input type="submit" name="login" id="login" onclick="myoffice.submit()" value="Sign in" onmouseover="this.className='button-style02'" onmouseout="this.className='button-style01'" class="button-style01" style="width:70px;" />

<a href="#" onmouseover="this.className='button-style02'" onmouseout="this.className='button-style01'" class="button-style01">Join Free</a>
网站地图 - 域名注册续费虚拟主机代理 - 交易论坛 - 网站投稿 - 广告服务 - 帮助中心 - 联系我们
Copyright ©2003-2007 www.Admin5.com All Rights Reserved