您现在的位置 » 博客首页 » 前端代码

DIV+CSS 滑动门技术的简单例子

2007-02-10
以下是客齐集网站上应用的一个导航条.

这次写的没有直接在STYLE里用ID的形式控制.全部用的CLASS形式;



以下是CSS部分:

<style type="text/css">
#zishu li{ float:left; margin-left:5px; margin-top:50px;}
.nav_a a:link,.nav_a a:visited{text-decoration:none; display:block; padding-right:10px; background:url(http://www.zishu.cn/attachments/month_0702/v200721005948.gif) no-repeat right top;margin-top:3px; color:#000; float:left;}
.nav_a span{cursor:han&#100;;background-color: #DBF0C4; font-size:14px;background:url(http://www.zishu.cn/attachments/month_0702/x200721005941.gif) no-repeat; display:block; line-height:29px; padding-left:10px; cursor:han&#100;; float:left;}
.nav_a a:hover,.nav_a active{text-decoration:none; display:block; padding-right:10px; background:url(http://www.zishu.cn/attachments/month_0702/v200721005948.gif) no-repeat right bottom;margin-top:0px; color:#000}
.nav_a a:hover span,.nav_a a:active span{background-color: #DBF0C4; font-size:14px;background: url(http://www.zishu.cn/attachments/month_0702/x200721005941.gif)  no-repeat  left bottom; display:block; line-height:29px; padding-left:10px; margin-top:0px; padding-top:1px; padding-bottom:2px; cursor:han&#100;;}
#box{ background:#009900; height:4px; overflow:hidden; clear:both}
</style>


以下是BODY部分:

<ul id="zishu">
  <li class="nav_a"><a href="http://fenlei.zishu.cn/l.php?c=2104&a=21"><span>兼职实习</span></a></li>
  <li class="nav_a"><a href="http://fenlei.zishu.cn/l.php?c=2107&a=21"><span>车辆买卖</span></a></li>
  <li class="nav_a"><a href="http://fenlei.zishu.cn/l.php?c=2101&a=21"><span>同城活动</span></a></li>
  <li class="nav_a"><a href="http://fenlei.zishu.cn/l.php?c=2102&a=21"><span>房屋租售</span></a></li>
  <li class="nav_a"><a href="http://fenlei.zishu.cn/l.php?c=2105&a=21"><span>同城寻缘</span></a></li>
  <li class="nav_a"><a href="http://fenlei.zishu.cn/l.php?c=2103&a=21"><span>跳蚤市场</span></a></li>
  <li class="nav_a"><a href="http://fenlei.zishu.cn/l.php?c=2108&a=21"><span>个人服务</span></a></li>
  <li class="nav_a"><a href="http://fenlei.zishu.cn/l.php?c=2106&a=21"><span>学习与培训培训</span></a></li>
</ul>


看效果:




说明:

1.CSS没有特别的优化.
2.可自动适应多字和少字.例如:学习与培训培训[/url]是7个字;
3.用到了两张图片.左边一张.右边一张;
4.加了鼠标移上去跳一下的效果;
5.这个例子写的不复杂.合适于初学者;

如果你认为这个色彩不玄,你可以看一下这个例子. 也许你会喜欢.
[url=http://www.zishu.cn/blogview.asp?logID=436]仿淘宝首页导航条布局效果


[idea]
评论:23 条 | 查看:115875 次
Suitear于2010年11月02日23点05分38秒说
这是我搜索进来的页面,11W啊~大哥,你在Css 滑动门的关键字有着惊人的排名~
sad于2008年11月12日8点00分00秒说
[idea]
webhoKO于2008年07月31日8点00分00秒说
再FF下显示有点问题,在#zishu li{}中应该再加一句
list-style:none;
Melissik于2008年05月08日8点00分00秒说
One afternoon, I was in the backyard hanging the laundry when an old, tired-looking dog wan&#100;ered into the yard. I could tell from his collar an&#100; well-fed belly that he had a home. But when I walked into the house, he followed me, sauntered down the hall an&#100; fell asleep in a corner. An hour later, he went to the door, an&#100; I let him out. The next day he was back. He resumed his position in the hallway an&#100; slept for an hour.
This continued for several weeks. Curious, I pinned a note to his collar: "Every afternoon your dog comes to my house for a nap. "
The next day he arrived with a different note pinned to his collar: "He lives in a home with ten children - he's trying to catch up on his sleep."

I cried from laughter
Sorry, if not left a message on Rules.
55555537于2008年01月27日8点00分00秒说
一点也不好完啊
芳芳73于2008年01月22日8点00分00秒说
一声问候,

一个愿望,

一串祝福

望你心中常有快乐涌现……
锐风于2007年12月11日8点00分00秒说
你这个不支持Safari...
fozlefe于2007年08月03日8点00分00秒说
[quote][b]最初由 [color=blue]dsfdsf[/color] 发表于 2007-07-19 01:45 PM:[/b]
dsfdsfdsfdsfdstbcgold.com[/quote]
sss
dfdsfdsf于2007年07月19日8点00分00秒说
ddfds
dsfdsf于2007年07月19日8点00分00秒说
dsfdsfdsfdsfds
tbcgold.com

发布评论/留言

名字/昵称:
内容: