导航滑动效果出错,请高人指点!!!!!!

王朝知道·作者佚名  2011-12-09
窄屏简体版  字體: |||超大  
 
分類: 電腦/網絡 >> 程序設計 >> 其他編程語言
 
問題描述:

麻烦各位给看一下,怎么鼠标移到后面的标题上,内容就往下错位了?怎么解决阿?谢谢了!!

<style type="text/css">

<!--

.tabs{float:left;width:567px; margin:0;}

.tabs_title{float:left;width:567px; height:22px;}

.tabs_image{float:left;width:87px; height:22px;}

.tabs_title_01{float:left;width:50px; height:20px;padding-left:30px;padding-top:2px;margin:0;background:#FFEEFE; cursor:hand;color:#F769FB;}

.tabs_title_02{float:left;width:50px; height:20px;padding-left:30px;padding-top:2px;margin:0;background:#F9DAFA; cursor:hand;color:#F769FB;}

.tabs_title_03{float:left;padding:0;width:0; height:0px;margin:0; overflow:hidden;color:#F769FB;}

.tabs_content{float:left;width:567px;}

-->

</style>

<SCRIPT language=JavaScript>

var tID=0;

function showTabs(ID){

if(ID!=tID){

TabTitle[tID].className='tabs_title_01';

TabTitle[ID].className='tabs_title_02';

TabContent[tID].style.display='none';

TabContent[ID].style.display='';

tID=ID;

}

}

</script>

<div class="tabs">

<div class="tabs_title">

<div class="tabs_image">title</div>

<div class="tabs_title_02" id="TabTitle" onMouseover="showTabs(0)">标题1</div>

<div class="tabs_title_03"></div>

<div class="tabs_title_01" id="TabTitle" onMouseover="showTabs(1)">标题2</div>

<div class="tabs_title_03"></div>

<div class="tabs_title_01" id="TabTitle" onMouseover="showTabs(2)">标题3</div>

</div>

<div class="tabs_content" id="TabContent" style="display:block;">

<table width="567" border="1" cellpadding="0" cellspacing="0" class="border_pink">

<tr>

<td height="150" align="center" valign="middle" scope="col">内容1</td>

</tr>

</table>

</div>

<div class="tabs_content" id="TabContent" style="display:none;">

<table width="567" border="1" cellpadding="0" cellspacing="0" class="border_pink">

<tr>

<td height="150" align="center" valign="middle" scope="col">内容2</td>

</tr>

</table>

</div>

<div class="tabs_content" id="TabContent" style="display:none;">

<table width="567" border="1" cellpadding="0" cellspacing="0" class="border_pink">

<tr>

<td height="150" align="center" valign="middle" scope="col">内容3</td>

</tr>

</table>

</div>

</div>

參考答案:

把tabs_content{float:left;width:567px;} 改为

tabs_content{width:567px;} 就可以了

float 属性的说明:

当该属性不等于 none 引起对象浮动时,对象将被视作块对象( block-level ),即 display 属性等于 block 。也就是说,浮动对象的 display 属性将被忽略。

所以tab1还是占了位了.

小贴士:① 若网友所发内容与教科书相悖,请以教科书为准;② 若网友所发内容与科学常识、官方权威机构相悖,请以后者为准;③ 若网友所发内容不正确或者违背公序良俗,右下举报/纠错。
 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航