CSS读取图片坐标实现图片背景,只需加载一次图片,就可以实现整个页面的背景,现在很多门户网站都在使用,比如网易163、腾讯等,以下是126邮箱登陆页面的登陆按钮部分:
<style type="text/css">
.inp_L1,.inp_L2{background:url('http://www.zzsky.cn/build/images/200851603033.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" >

 

 

<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>
jyjyjyjy
<div >
 <ul>
  <li ><span>
 游 戏</span></a></li>
  <li ><span>
 娱 乐</span></a></li>
  <li ><span>
 菜 单</span></a></li>
  <li ><span>
 好 玩</span></a></li>  
 </ul>
</div>
</body>
</html>

相关文章:

  • 2021-06-26
  • 2021-11-24
  • 2021-06-30
  • 2021-12-05
  • 2022-12-23
  • 2021-12-16
猜你喜欢
  • 2022-12-23
  • 2022-01-16
  • 2022-12-23
  • 2022-12-23
  • 2022-02-07
  • 2022-02-07
  • 2022-02-07
相关资源
相似解决方案