2009-06-14 74 views
1

我有問題定位左邊欄(variating高度DIV)在IE6上。CSS變異高度問題與IE6

主要需求: 1.我無法設置高度值,導致高度變化,應該由瀏覽器計算。 2.側欄必須有頂部和底部的間距。

頂欄問題通過將位置替換爲相對來解決。

任何想法?先謝謝你 !

下面您可以看到簡化的代碼和快照在標準瀏覽器上的外觀。

.container { 
    left: 550px; 
    top: 10px; 
    width: 196px; 
    position: absolute; 
    line-height: 0px; 
    font-size: 1px; 
} 
.inner { 
    width: 100%; 
    height: 114px; 
    background-color: rgb(227, 227, 227); 
} 
.leftbar { 
    left: 0px; 
    top: 7px; 
    bottom: 7px; 
    width: 4px; 
    position: absolute; 
    background-color: rgb(111, 111, 111); 
} 
.topbar { 
    left: 7px; 
    top: 0px; 
    right: 7px; 
    height: 4px; 
    position: absolute; 
    background-color: rgb(111, 111, 111); 
} 

<div class="container"> 
    <div class="inner"></div> 
    <div class="leftbar"></div> 
    <div class="topbar"></div> 
</div> 

LINK TO SCREEN SHOT IMAGE

+1

爲什麼人們堅持繼續使用IE6? – 2009-06-14 04:44:58

回答

1

IE6是極其糟糕,當談到絕對定位。從左,右或從上,下同時定位某物不起作用。

你基本上有四個選項:

  1. 對IE6的支持拖放。
  2. 放棄絕對定位並使用其他方法(例如浮點數)。
  3. 爲IE6提供虛擬版本的網站 - 例如使用條件註釋覆蓋某些樣式。
  4. 使用JavaScript來幫助IE6定位(例如absolutefudge.js)。