风讯官方论坛FoosunCMS交流区Foosun4.x安装使用[已解决]用div+css怎么实现这种特效

1  /  1  页   1 跳转 查看:746

标题: [已解决]用div+css怎么实现这种特效

[已解决]用div+css怎么实现这种特效

测试页:www.orab.cn

里面的:

产品说明详细资料相关产品成功案例购物指南网友评论

每移到一个标题就显示相关内容

现在问题是

那是用table 实现的,请问,怎么用div+css把那个唯一的一个table替换掉?


[此贴子已经被作者于2006-11-3 20:10:17编辑过]

引用
 

同求。。
引用
 

该用户帖子内容已被屏蔽
造反等人删号!
引用
 

Ksir,好样的,贴出你的QQ,让我们向你学习一下。

引用
 

把样式和你的代码放那里啊???

引用
 

谢谢ksir!!!!

引用
 



引用:
<style>
body {font-size:12px;font-family:宋体}
ul.TabBarLevel1{
 list-style:none;
 margin:0;
 padding:0;
 height:29px;
 background-image:url(http://pics.taobao.com/2k5/sys/component/tabbar_level1_bk.gif);
}
ul.TabBarLevel1 li{
 float:left;
 padding:0;
 height:29px;
 margin-right:1px;
 background:url(http://pics.taobao.com/2k5/sys/component/tabbar_level1_slice_left_bk.gif) left top no-repeat;
}
ul.TabBarLevel1 li a{
 display:block;
 line-height:29px;
 padding:0 20px;
 color:#333;
 background:url(http://pics.taobao.com/2k5/sys/component/tabbar_level1_slice_right_bk.gif) right top no-repeat;
 white-space: nowrap;
}
ul.TabBarLevel1 li.Selected{
 background:url(http://pics.taobao.com/2k5/sys/component/tabbar_level1_slice_selected_left_bk.gif) left top no-repeat;
}
ul.TabBarLevel1 li.Selected a{
 background:url(http://pics.taobao.com/2k5/sys/component/tabbar_level1_slice_selected_right_bk.gif) right top no-repeat;
}

ul.TabBarLevel1 li a:link,ul.TabBarLevel1 li a:visited{
 color:#333;
}
ul.TabBarLevel1 li a:hover,ul.TabBarLevel1 li a:active{
 color:#F30;
 text-decoration:none;
}
ul.TabBarLevel1 li.Selected a:link,ul.TabBarLevel1 li.Selected a:visited{
 color:#000;
}
ul.TabBarLevel1 li.Selected a:hover,ul.TabBarLevel1 li.Selected a:active{
 color:#F30;
 text-decoration:none;
}
div.HackBox {
  padding : 2px 2px ;
  border-left: 2px solid #6697CD;
  border-right: 2px solid #6697CD;
  border-bottom: 2px solid #6697CD;
  display:none;
}

</style>

 

<div id="Whatever">
 <ul class="TabBarLevel1" id="TabPage1">
  <li id="Tab1"><a href="#" onclick="javascript:switchTab('TabPage1','Tab1');">子虚乌有</a></li>
  <li  id="Tab2" class="Selected"><a href="#" onclick="javascript:switchTab('TabPage1','Tab2');">金翅擘海</a></li>
  <li  id="Tab3"><a href="#" onclick="javascript:switchTab('TabPage1','Tab3');"><B><font color="#22FF22">知</font><font color="#FF2222">往</font><font color="#001199">观</font><font color="#00fffa">来</font></B></a></li>
  <li  id="Tab4"><a href="#" onclick="javascript:switchTab('TabPage1','Tab4');">我太低调</a></li>
 </ul>
 <div id="cnt">
 <div id="dTab1" class="HackBox">我为每一次的快乐而哭泣,我为每一次的悲伤而微笑。
 </div>
 <div id="dTab2" class="HackBox" style="display:block">【※卡秀儿精品屋※】

 </div>
 <div id="dTab3" class="HackBox">学习是件头疼的事,为了能活下去我不得不学习

 </div>
 <div id="dTab4" class="HackBox">仍然拣尽寒枝不肯安歇 微带着后悔 寂寞沙洲我该思念谁
 </div>
 </div>
</div>
<script language="JavaScript">
//Switch Tab Effect
function switchTab(tabpage,tabid){
        var oItem = document.getElementById(tabpage);  
 for(var i=0;i<oItem.children.length;i++){
  var x = oItem.children(i); 
  x.className = "";
  var y = x.getElementsByTagName('a');
  y[0].style.color="#333333";
 } 
 document.getElementById(tabid).className = "Selected";
 var dvs=document.getElementById("cnt").getElementsByTagName("div");
 for (var i=0;i<dvs.length;i++){
   if (dvs.id==('d'+tabid))
     dvs.style.display='block';
   else
     dvs.style.display='none';
 }
}

</script>

 

引用:

<!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;
 }
}
</script>
</head>

<body>
<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>会员注册与登录</span></a></li>
      <li id="tag5"><a href="#" onclick="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>

新野视窗 专业网站设计服务!设计定做QQ:612189 群号:2693538
服务理念:做生意,要讲规矩;做服务,要讲热情;做人,要讲厚道!总之,两个字“信誉”!
引用
 
1  /  1  页   1 跳转

版权所有 Foosun.NET  NewsCMS.com  NewsIDC.COM  Sitemap

Powered by Discuz!NT 2.0.1115    Copyright © 2001-2008 Comsenz Inc.
Processed in 0 second(s) (Cached).
返顶部