标题: [Css] 通过css来读取图片坐标系实现局部背景图二
发表于 2007-11-30 01:21 第1楼由 WOlf 发起
WOlf
21SEA+
Rank: 4
八零帮主
UID 21182
精华 16
积分 23
帖子 7066
金钱 18883 A币
阅读权限 1
注册 2004-7-20
来自 上海
状态 离线
通过css来读取图片坐标系实现局部背景图二



<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://bbs.arting365.com/attachments/month_0711/20071130_4c9fd59d41a2d36a2afd6Kkh1dSwMcKT.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 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>

[ 本帖最后由 WOlf 于 2007-11-30 01:23 编辑 ]



查看积分策略说明
附件
2007-11-30 01:22
200682494749491.gif (4.06 KB)
 
顶部
发表于 2007-12-7 11:58 第2楼由 vavalen 发起
vavalen
新生入学
Rank: 1
UID 243279
精华 0
积分 0
帖子 30
金钱 30 A币
阅读权限 10
注册 2007-12-1
状态 离线
thank you! learned backgroud-postion 's property and display:block . it is successful.

顶部


当前时区 GMT+8, 现在时间是 2008-12-2 01:54