css按钮

[收藏]用CSS实现的一张图完成的按钮效果

首先是在www.126.com上发现的,感觉很好用很奥妙,值得收藏和分享
通过css来读取图片坐标系实现局部背景图

这个是网易126上的登陆按钮
[html]
<style>
.inp_L1,.inp_L2,{background:url(http://mimg.126.com/index/bg_x.jpg) no-repeat}
.inp_L1{ width:67px; height:23px; background-position:-4px -4px; border:0; color:#464646; line-height:23px}
.inp_L2{ width:67px; height:23px; background-position:-4px -30px; border:0; color:#464646; line-height:23px}
</style>
<input type="submit" value="登 录" class="inp_L1" onMouseOver="this.className='inp_L2'" onMouseOut="this.className='inp_L1'" id="input_btn1"  name="enter.x" tabindex="4">
[/html]


另外一个导航按钮
[html]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>用CSS实现的一张图完成的导航条</title>
<style>
ul,li{ list-style:none; float:left;}
body{ font-size:12px; line-height:1.6; font-family:Verdana, "宋体", Arial; text-align:center;}
#info li{ margin-left:4px; margin-top:15px;}
#info a {display:block;text-align:center; padding-left:15px;
padding-top:2px;padding-bottom:1px;background-image:
url(http://www.jscode.cn/Uploadfile/200682494749491.GIF);
background-repeat: no-repeat;color: #000; width:47px; cursor:hand; text-decoration: none;}
#job a:link,#job a:visited{background-position: -62px 0px;}
#eve a:link,#eve a:visited{background-position: -124px 0px;}
#oth a:link,#oth a:visited{background-position: -186px 0px;}
#car a:hover ,#car a:active {background-position: 0px -22px; color:#fff;}
#job a:hover ,#car a:active {background-position: -62px -22px; color:#fff;}
#eve a:hover ,#car a:active {background-position: -124px -22px; color:#fff;}
#oth a:hover ,#car a:active {background-position: -186px -22px; color:#fff;}
</style>
</head>

<body>
<div id="info">
<ul>
  <li id="car"><a href="#" target="_blank"><span>
游 戏</span></a></li>
  <li id="job"><a href="#" target="_blank"><span>
娱 乐</span></a></li>
  <li id="eve"><a href="#" target="_blank"><span>
菜 单</span></a></li>
  <li id="oth"><a href="#" target="_blank"><span>
好 玩</span></a></li>   
</ul>
</div>
</body>
</html>
[/html]
 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值