2012-07-25 25 views
0

我有一個關於CSS浮動和位置在IE6中的問題,我實現第二級孩子的樹視圖不會顯示到左側鼠標懸停時,這不會發生在IE7-9和其他瀏覽器(Mozilla FireFox & Chrome),但IE6。CSS浮動和位置不工作在IE6

請找到下面我的樣本樹視圖代碼片段:

<style type="text/css"> 
    .treeView 
    { 
     font-family: Century Gothic; 
     font-size: 13px; 
     font-weight: bold; 
     color: #ff6500; 
    } 

    /* hyperlink style */ 
    .treeView a 
    { 
     color: #ff6500; 
     text-decoration: none; 
    } 

    /* hyperlink hover style */ 
    .treeView a:hover 
    { 
     color: #ff6500; 
     text-decoration: underline; 
    } 

    .treeView ul 
    { 
     list-style: none; 
     margin: 0; 
     padding: 0; 
     width: 246px; 
    } 

    .treeView ul li 
    { 
     height: 100%; 
     background: #def0f6; 
     position: relative; 
     float: left; 
     width: 100%; 
     z-index: 3; 
    } 

    /* item background color */ 
    .treeView li 
    { 
     background: #def0f6; 
     border-top: 1px solid #007dc6; 
     border-left: 1px solid #007dc6; 
     border-right: 1px solid #007dc6; 
    } 

    .treeView ul li a, .treeView ul li span 
    { 
     display: block; 
     padding: 5px 8px 5px 15px; 
    } 

    /* hide and align child item, and child width */ 
    .treeView ul ul 
    { 
     position: absolute; 
     top: -1px; 
     visibility: hidden; 
    } 

    /* item background color when hover */ 
    .treeView li:hover 
    { 
     background: #ffffd8; 
    } 

    /* display child item when hover parent item */ 
    .treeView li:hover > ul 
    { 
     visibility: visible; 
    } 

    /* align 2nd child item to left when hover parent item */ 
    .treeView li:hover ul 
    { 
     display: block; 
     left: 246px; 
    } 
</style> 

<div class='treeView'> 
    <ul> 
     <li><span class='submenu'>Level 1</span> 
      <ul> 
       <li><a href='#' class='submenu'>Level 2</a> 
        <ul> 
         <li><a href='#'>Level 3</a></li> 
        </ul> 
       </li> 
      </ul> 
     </li> 
    </ul> 
</div> 

我懷疑這是由於CSS的float:左和位置:相對。 任何想法如何float:在IE 6中工作?請幫忙

謝謝高級。

+2

接近2013年,您仍在使用IE6。這是一個悲傷的日子。 – Marwelln 2012-07-25 09:51:20

+0

上帝忘記IE6現在..這是刺激... – 2012-07-25 09:53:33

+0

這是一個互聯網面臨的網站,解決方案必須支持IE和跨瀏覽器的多個版本 – sams5817 2012-07-25 09:58:12

回答

2

子選擇器>在IE6中不起作用。你可以通過重寫你的CSS來更改它,或者使用類來確定你所處的級別。 可能還有其他問題;您應該使用display: none;而不是visibility: hiddenvisibility變化真的只有可見性,但佈局等受到影響。 display: none把元素拿出來,是你真正想要的。