网站首页
关于深山
客户案例
业务范围
联系深山
网络投票系统
企业网站建设
旅行社网站建设
小程序
留言板
技术文章
许愿墙(qq爱墙)
技术首页
百度小程序开发
微信小程序开发
微信公众号开发
uni-app
asp函数库
ASP
asp.net
DIV+CSS
HTML
SEO搜索引擎忧化
下载类信息
个人空间
代码生成
电商
python
页面特效
表格特效
导航菜单
图形特效
表单特效
时间日期
色彩类别
链接特效
网页特效
系统硬件
网站公告
网页学习
技术类文章
网站类信息
订阅本栏目 RSS
您所在的位置:
深山工作室
>
导航菜单
> 正文
仿淘宝网站的导航标签效果!
http://bbs.blueidea.com 2009/2/2 10:27:43 深山行者 字体:
大
中
小
浏览 6152
以下为详细代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> <style type="text/css"> <!-- * { margin: 0; padding:0 } body { margin-top: 10px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; height: auto; width: auto; background-color: #666666; font-size: 12px; color: #000000; } #container { text-align: left; width: 760px; height: 400px; background-color: #FFFFFF; padding: 20px; } #container #title { height: 28px; } #container #title li { float: left; list-style-type: none; height: 28px; line-height: 28px; text-align: center; margin-right: 1px; } #container #title ul { background-color: #FFFFFF; height: 28px; } #container #title a { text-decoration: none; color: #000000; display: block; width: auto; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_left_bk2.gif") no-repeat left -29px; } #container #title a span{ display: block; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_right_bk2.gif") no-repeat right -29px; padding: 0 15px 0 15px; } #container #title #tag1 a:hover { text-decoration: none; color: #ffffff; display: block; width: auto; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_left_bk2.gif") no-repeat left -87px; } #container #title #tag1 a:hover span{ display: block; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_right_bk2.gif") no-repeat right -87px; padding: 0 15px 0 15px; } #container #title #tag2 a:hover { text-decoration: none; color: #ffffff; display: block; width: auto; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_left_bk2.gif") no-repeat left 0px; } #container #title #tag2 a:hover span{ display: block; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_right_bk2.gif") no-repeat right 0px; padding: 0 15px 0 15px; } #container #title #tag3 a:hover { text-decoration: none; color: #ffffff; display: block; width: auto; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_left_bk2.gif") no-repeat left -58px; } #container #title #tag3 a:hover span{ display: block; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_right_bk2.gif") no-repeat right -58px; padding: 0 15px 0 15px; } #container #title #tag4 a:hover { text-decoration: none; color: #ffffff; display: block; width: auto; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_left_bk2.gif") no-repeat left -145px; } #container #title #tag4 a:hover span{ display: block; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_right_bk2.gif") no-repeat right -145px; padding: 0 15px 0 15px; } #container #title #tag5 a:hover { text-decoration: none; color: #ffffff; display: block; width: auto; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_left_bk2.gif") no-repeat left -174px; } #container #title #tag5 a:hover span{ display: block; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_right_bk2.gif") no-repeat right -174px; padding: 0 15px 0 15px; } #container #title #tag6 a:hover { text-decoration: none; color: #ffffff; display: block; width: auto; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_left_bk2.gif") no-repeat left -203px; } #container #title #tag6 a:hover span{ display: block; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_right_bk2.gif") no-repeat right -203px; padding: 0 15px 0 15px; } #container #title #tag7 a:hover { text-decoration: none; color: #ffffff; display: block; width: auto; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_left_bk2.gif") no-repeat left -232px; } #container #title #tag7 a:hover span{ display: block; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_right_bk2.gif") no-repeat right -232px; padding: 0 15px 0 15px; } #container #title #tag8 a:hover { text-decoration: none; color: #ffffff; display: block; width: auto; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_left_bk2.gif") no-repeat left -261px; } #container #title #tag8 a:hover span{ display: block; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_right_bk2.gif") no-repeat right -261px; padding: 0 15px 0 15px; } #container #title .selectli1 { text-decoration: none; color: #ffffff; display: block; width: auto; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_left_bk2.gif") no-repeat left -87px; } #container #title a .selectspan1 { display: block; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_right_bk2.gif") no-repeat right -87px; padding: 0 15px 0 15px; } #container #title .selectli2 { text-decoration: none; color: #ffffff; display: block; width: auto; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_left_bk2.gif") no-repeat left 0px; } #container #title a .selectspan2 { display: block; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_right_bk2.gif") no-repeat right 0px; padding: 0 15px 0 15px; } #container #title .selectli3 { text-decoration: none; color: #ffffff; display: block; width: auto; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_left_bk2.gif") no-repeat left -58px; } #container #title a .selectspan3 { display: block; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_right_bk2.gif") no-repeat right -58px; padding: 0 15px 0 15px; } #container #title .selectli4 { text-decoration: none; color: #ffffff; display: block; width: auto; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_left_bk2.gif") no-repeat left -145px; } #container #title a .selectspan4 { display: block; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_right_bk2.gif") no-repeat right -145px; padding: 0 15px 0 15px; } #container #title .selectli5 { text-decoration: none; color: #ffffff; display: block; width: auto; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_left_bk2.gif") no-repeat left -174px; } #container #title a .selectspan5 { display: block; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_right_bk2.gif") no-repeat right -174px; padding: 0 15px 0 15px; } #container #title .selectli6 { text-decoration: none; color: #ffffff; display: block; width: auto; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_left_bk2.gif") no-repeat left -203px; } #container #title a .selectspan6 { display: block; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_right_bk2.gif") no-repeat right -203px; padding: 0 15px 0 15px; } #container #title .selectli7 { text-decoration: none; color: #ffffff; display: block; width: auto; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_left_bk2.gif") no-repeat left -232px; } #container #title a .selectspan7 { display: block; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_right_bk2.gif") no-repeat right -232px; padding: 0 15px 0 15px; } #container #title .selectli8 { text-decoration: none; color: #ffffff; display: block; width: auto; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_left_bk2.gif") no-repeat left -261px; } #container #title a .selectspan8 { display: block; background: url("http://pics.taobao.com/2k5/sys/component/tab_selected_right_bk2.gif") no-repeat right -261px; padding: 0 15px 0 15px; } #container #content ul {margin: 10px;} #container #content li {margin: 5px; } #container #content li img {margin: 5px;display:block;} #container #content { height: 300px; padding: 10px; } .content1 { border-top-width: 3px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #3A81C8; border-right-color: #3A81C8; border-bottom-color: #3A81C8; border-left-color: #3A81C8; background-color: #DFEBF7; } .content2 { border-top-width: 3px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #ff950b; border-right-color: #ff950b; border-bottom-color: #ff950b; border-left-color: #ff950b; background-color: #FFECD2; } .content3 { height: 300px; padding: 10px; border-top-width: 3px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #FE74B8; border-right-color: #FE74B8; border-bottom-color: #FE74B8; border-left-color: #FE74B8; background-color: #FFECF5; } .content4 { height: 300px; padding: 10px; border-top-width: 3px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #00988B; border-right-color: #00988B; border-bottom-color: #00988B; border-left-color: #00988B; background-color: #E8FFFD; } .content5 { height: 300px; padding: 10px; border-top-width: 3px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #A8BC1F; border-right-color: #A8BC1F; border-bottom-color: #A8BC1F; border-left-color: #A8BC1F; background-color: #F7FAE2; } .content6 { height: 300px; padding: 10px; border-top-width: 3px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #DD5A31; border-right-color: #DD5A31; border-bottom-color: #DD5A31; border-left-color: #DD5A31; background-color: #E7A996; } .content7 { height: 300px; padding: 10px; border-top-width: 3px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #B65E5D; border-right-color: #B65E5D; border-bottom-color: #B65E5D; border-left-color: #B65E5D; background-color: #C29A99; } .content8 { height: 300px; padding: 10px; border-top-width: 3px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #B67BD8; border-right-color: #B67BD8; border-bottom-color: #B67BD8; border-left-color: #B67BD8; background-color: #E8C4FF; } .hidecontent {display:none;} --> </style> <script language="javascript"> function switchTag(tag,content) { // alert(tag); // alert(content); for(i=1; i <9; i++) { if ("tag"+i==tag) { document.getElementById(tag).getElementsByTagName("a")[0].className="selectli"+i; document.getElementById(tag).getElementsByTagName("a")[0].getElementsByTagName("span")[0].className="selectspan"+i; }else{ document.getElementById("tag"+i).getElementsByTagName("a")[0].className=""; document.getElementById("tag"+i).getElementsByTagName("a")[0].getElementsByTagName("span")[0].className=""; } if ("content"+i==content) { document.getElementById(content).className=""; }else{ document.getElementById("content"+i).className="hidecontent"; } document.getElementById("content").className=content; } } </script> </head> <body> <table width="950" border="0" align="center"> <tr> <td height="94" colspan="3"><div id="container"> <div id="title"> <ul> <li id="tag1"><a href="#" onclick="switchTag('tag1','content1');this.blur();" class="selectli1"><span class="selectspan1">首页</span></a></li> <li id="tag2"><a href="#" onclick="switchTag('tag2','content2');this.blur();"><span>产品介绍</span></a></li> <li id="tag3"><a href="#" onclick="switchTag('tag3','content3');this.blur();"><span>连锁加盟</span></a></li> <li id="tag4"><a href="#" onclick="switchTag('tag4','content4');this.blur();"><span>CCSOS常识</span></a></li> <li id="tag5"><a href="#" onclick="switchTag('tag5','content5');this.blur();"><span>培训资讯</span></a></li> <li id="tag6"><a href="#" onclick="switchTag('tag6','content6');this.blur();"><span>长沙旗舰馆</span></a></li> <li id="tag7"><a href="#" onclick="switchTag('tag7','content7');this.blur();"><span>提问区</span></a></li> <li id="tag8"><a href="#" onclick="switchTag('tag8','content8');this.blur();"><span>联系我们</span></a></li> </ul> </div> <div id="content" class="content1"> <div id="content1"><p>仿淘宝网站的导航效果。此方法有几个优点:</p>1、根据字数自适应项目长度</div> <div id="content2" class="hidecontent">2、不同的项目使用不同的颜色来区分</div> <div id="content3" class="hidecontent">3、这回需要使用到js了,呵呵</div> <div id="content4" class="hidecontent">4、背景图片只需要两个图片文件就足够,减少服务器负担</div> <div id="content5" class="hidecontent">5、这是使用到的两个图片: <table width="58%" border="1" cellspacing="2" cellpadding="0"> <tr> <td width="70%" align="center"><img src="http://pics.taobao.com/2k5/sys/component/tab_selected_left_bk2.gif" width="250" height="290" /></td> <td width="30%" align="center"><img src="http://pics.taobao.com/2k5/sys/component/tab_selected_right_bk2.gif" width="15" height="290" /></td> </tr> </table> </div> <div id="content6" class="hidecontent">6.不是什么地方用ajax都合适的!</div> <div id="content7" class="hidecontent">7.该刷新的地方还是要刷新!</div> <div id="content8" class="hidecontent">8.刷新用cookie保存还是很不方便的!!!!!!!! </div> </div> </div></td> </tr> <tr> <td> </td> <td> </td> </tr> </table> </body> </html>
前一页:
模仿as效果的跳动导航菜单
后一页:
没有了
相关阅读
利用position把div放在flash上
微软Encoder加密解密函数
网页中自动换行问题
利用javascript高亮关键词系列
小程序中利用addPhoneContact将联系人的信息添加到手机通讯录支持保存联系人头像
CSS代码格式化和压缩化
jquery下拉到某个固定位置然后某些元素发生改变样式状态
仿MAC官网导航菜单
更多信息>>
栏目类别选择
百度小程序开发
微信小程序开发
微信公众号开发
uni-app
asp函数库
ASP
DIV+CSS
HTML
python
更多>>
同类信息
div+CSS的无限级扩展下拉菜单(全部加了注释)
经典的仿蓝色理想TAB横向下拉菜单效果
纯div+css制作的弹出菜单-05
纯div+css制作的弹出菜单-04
纯div+css制作的弹出菜单-02
纯div+css制作的弹出菜单-02
更多>>
最新添加文章
dw里面查找替换使用正则删除sqlserver里面的CONSTRAINT
Android移动端自动化测试:使用UIAutomatorViewer与Selenium定位元素
抖音直播音挂载小雪花 懂车帝小程序
javascript获取浏览器指纹可以用来做投票
火狐Mozilla Firefox出现:无法载入您的Firefox配置文件 它可能已经丢失 或是无法访问 问题解决集合处理办法
在Android、iOS、Windows、MacOS中微信小程序的文件存放路径
python通过代码修改pip下载源让下载库飞起
python里面requests.post返回的res.text还有其它的吗
更多>>
随机抽取信息
表格斜线
万家乐
昆山假日旅行社
取得鼠标所在位置的对象
连云港天天美食网
四川省旅者旅行社有限公司总部
更多标签
热门标签
字体
变幻
管理
图层
文章
返回
显示器
asasds
按钮
替换
innerHTML
字符
页面
圆角
DOCTYPE
学习
Java
右击失效
源码
important
首字母
px
多选框
载入
在线
链接样式
处理
理想
自适应
Request
数字
失效
button
动画
转换
open
动态
繁体
右键
png24
命名
评论
布局
选项卡
网页制作
奋斗
颜色
行号
flash
竖排
免责声明:本站所有资料信息,有部分为本人原创,部分为从网络收集而来,仅供网友查看阅读所用,所有信息版权归信息所有人或所有公司所有
如果信息内容侵犯到您的版权或权益请与我们联系,经确认后我们会立即移除相关内容或链接
Copyright © 2007-2026
深山工作室
All Rights Reserved
服务QQ:
565449214
手机:
13961347334
ICP备案:
苏ICP备15019627号
苏公网安备 32070502010230号