仿淘宝网站的TabPage导航效果

代码如下:
<!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 .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 #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; } .hidecontent {display:none;} --> </style> <script language="javascript"> function switchTag(tag,content) { // alert(tag); // alert(content); for(i=1; i <6; 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; } } function init(){ t=document.location.hash.replace('#',''); if(t=='')t=1; switchTag('tag'+t,'content'+t); } </script> </head> <body οnlοad="init()"> <div id="container"> <div id="title"> <ul> <li id="tag1"><a href="#1" οnclick="switchTag('tag1','content1');this.blur();" class="selectli1"><span class="selectspan1">首页</span></a></li> <li id="tag2"><a href="#2" οnclick="switchTag('tag2','content2');this.blur();"><span>下载中心</span></a></li> <li id="tag3"><a href="#3" οnclick="switchTag('tag3','content3');this.blur();"><span>产品介绍</span></a></li> <li id="tag4"><a href="#4" οnclick="switchTag('tag4','content4');this.blur();"><span>会员注册与登录</span></a></li> <li id="tag5"><a href="#5" οnclick="switchTag('tag5','content5');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> </div> </body> </html>
[Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]

转载于:https://www.cnblogs.com/Dicky/archive/2006/05/16/401666.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/361561.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Java SE 8新功能介绍:Lambda的遍历,过滤,处理集合和方法增强

在“ Java SE 8新功能导览”系列的这篇文章中&#xff0c;我们将深入解释并探索代码&#xff0c;以了解如何使用lambda表达式和方法引用 遍历集合 &#xff0c;并使用谓词接口过滤它们&#xff0c;实现默认方法在接口中&#xff0c;最后在接口中实现静态方法 。 在上一篇文章“…

【原】相煎何太急——input的blur事件与button的click事件

先来一段引子&#xff0c;最近在写手机h5页面&#xff0c;主要是一些登陆注册方面的&#xff0c;最绕不开的就是表单元素。 我想实现的是&#xff1a;在输入框后边有一个删除图标&#xff0c;当输入东西的时候触发事件&#xff0c;显示删除图标&#xff0c;点击该图标会删除之…

由浅入深:自己动手开发模板引擎——置换型模板引擎(一)

编辑器加载中... 转自&#xff1a;http://www.cnblogs.com/ymind/archive/2012/03/31/progressively-develop-templateEngine-yourself-replacement-type-1.html 受到群里兄弟们的竭力邀请&#xff0c;老陈终于决定来分享一下.NET下的模板引擎开发技术。本系列文章将会带您由浅…

C#锐利体验-第八讲 索引器与操作符重载(转)

第八讲 索引器与操作符重载 南京邮电学院 李建忠&#xff08;cornyfield263.net&#xff09; 索引 C#锐利体验 "Hello,World&#xff01;"程序C#语言基础介绍Microsoft.NET平台基础构造类与对象 构造器与析构器方法域与属性索引器与操作符重载 数组与字符串特征与映射…

Java EE 7 / JAX-RS 2.0:具有自定义HTTP标头的简单REST API身份验证和授权

在使用已可用的HTTP协议实施Web服务时&#xff0c;REST带来了很多便利。 通过仅通过指定的URL触发GET&#xff0c;POST和其他HTTP方法&#xff0c;您将确保通过REST服务的响应来完成某些工作。 但是&#xff0c;无论REST给开发人员带来了什么便利&#xff0c;安全性和访问控制的…

关于form标签,你该知道

有没有发现&#xff0c;自己在写模板的时候很少使用form元素&#xff0c;一来form和table总是那么傻傻分不清楚&#xff1b;二来form的特性理解不清楚&#xff0c;有了input、label来了直接就上&#xff0c;根本不用form&#xff08;不知道有没有人和我一样&#xff09;。因此&…

一个微软面试题--关于位结构体

含位域结构体的sizeof: 前面已经说过&#xff0c;位域成员不能单独被取sizeof值&#xff0c;我们这里要讨论的是含有位域的结构体的sizeof&#xff0c;只是考虑到其特殊性而将其专门列了出来。 C99规定int、unsigned int和bool可以作为位域类型&#xff0c;但编译器几乎都对此作…

easyui树形菜单实现

需求&#xff1a;读取路径配置中的相对路径获取对应的子文件夹及其子文件并形成树形结构&#xff0c;加载xml文件&#xff0c;输入搜索关键字匹配xml里面的value节点的值对应的contact值的集合并进行搜索 例如&#xff1a;输入b&#xff0c;找到xml里面的文本节点等于b的value…

在Twitter上使用Apache Mesos和Apache Aurora进行资源调度和任务启动

播客的第23集是与Bill Farner的谈话 Bill解释了Twitter如何使用Apache Mesos和Apache Aurora在硬件上获得更多收益&#xff0c;并通过在整个基础架构中利用细粒度的资源调度来节省工程时间&#xff08;开发和运营&#xff09;。 Bill谈到了他在Borg上与Google一起在Google上所…

fatal error C1083: 无法打开预编译头文件:“Debug\a.pch”:No such file or directory

一、解决方法 右键点击你创建的项目&#xff0c;选择“属性标签”点击属性&#xff0c;弹出“项目属性页”&#xff0c;在左侧找到以下位置 配置属性 --> C/C --> 预编译头&#xff0c;并选择它&#xff1a;在右边的菜单中选择 “创建/使用预编译头”中的“不使用预编…

ubunt 下 配置samba 服务器

一. samba的安装: sudo apt-get insall sambasudo apt-get install smbfs 二。修改/etc/samba/smb.conf sudo gedit /etc/samba/smb.conf 在smb.conf最后添加 [myShare]comment Shared Folder with username and passwordpath /home/wangywriteable yesbrowseable yesguest…

Telnet初试(本地测试)

win7下开启Telnet功能&#xff1a; 控制面板-程序和功能- 开启服务 然后回车 这样即可完成一次请求 更多专业前端知识&#xff0c;请上 【猿2048】www.mk2048.com

织梦dede 5.7系统基本参数无法修改保存,提示Token mismatch!

织梦dede 5.7系统基本参数无法修改保存&#xff0c;总是提示Token mismatch! 最开始以为是文件权限问题&#xff0c;反复给权限无法解决。 百度了下&#xff0c;也没有好用的方法 最后还是要自己动手 在dede/sys_info.php 54行找到对应的内容 根据代码判断是 $token变量问题 打…

您是否真的要加快Maven的编译/打包速度? 那么takari生命周期插件就是答案。

像你们中的许多人一样&#xff0c;我正在使用多模块Maven项目 。 与现有的许多系统相比&#xff0c;这不是一个很大的数目&#xff0c;它具有15个模块&#xff0c;3种不同的耳朵部署&#xff0c;带有属性文件的大量参数化以及大约10万行Java代码。 在开发高峰期&#xff0c;由于…

手机MMI体系结构及其实现

摘自&#xff1a;http://blog.csdn.net/zc2007/article/details/2340436 1引言 MMI&#xff08;ManMachineInter-face&#xff09;&#xff0c;即人机界面&#xff0c;它负责和用户的交互&#xff0c;在必要的时候调用其它模块的功能。MMI模块在整个系统中处于最 高层&#x…

Aspose.Words简单生成word文档

Aspose.Words简单生成word文档 Aspose.Words.Document doc new Aspose.Words.Document(); Aspose.Words.DocumentBuilder builder new Aspose.W…

ubuntu下安装JDK和netbeans

我在ubuntu下安装netbeans十分简单&#xff0c;我下载了jdk-7u1-nb-7_0_1-linux-ml.sh&#xff0c;直接在终端输入 sh jdk-7u1-nb-7_0_1-linux-ml.sh安装的向导就会启动&#xff0c;你只要选择JDK和netbeans安装的目录&#xff0c;向导就自动替你安装jdk和netbeans&#xff0c;…

在带有组合框的值列表的下拉列表中显示显示属性的子集

组合框值列表&#xff08;inputComboboxListOfValues&#xff09;应该是使用LOV的非常流行的ADF Faces组件。 坦白说&#xff0c;这是我最喜欢的值列表方法。 在这篇简短的文章中&#xff0c;我将重点介绍ADF开发人员经常忽略的一项功能。 如果默认情况下定义了LOV&#xff0c;…

Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: jav

报错&#xff1a;Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: jav 原因&#xff1a;1、在对应的xml文件里面 #A#,只写了一个# 2、xml文件里面有多余的字符&#xff0c;如空格等 转载于:https://www.cnblogs.com/zzw3014/p/11316031.html

摆脱困境:在每种测试方法之前重置自动增量列

当我们为将信息保存到数据库的功能编写集成测试时&#xff0c;我们必须验证是否将正确的信息保存到数据库。 如果我们的应用程序使用Spring Framework&#xff0c;则可以为此目的使用Spring Test DbUnit和DbUnit 。 但是&#xff0c;很难验证是否在主键列中插入了正确的值&am…