2012-03-12 68 views
0

我有一個非常愚蠢的問題:我想要一個表格中的表格,其中有100%的表格單元格高度。問題是IE瀏覽器,它不會那樣做。在Chrome等它的作品(我想也是Firefox)。這裏是一個示例html文件:百分比桌子高度和IE9

<?xml version='1.0' encoding='UTF-8' ?> 
<!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=UTF-8" /> 
    <title>Test</title> 
<style type="text/css" media="screen"> 
body { 
    background-color: #ffffff; 
    font-size: 12px; 
    font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; 
    color: #000000; 

    height: 100%; 
    overflow: hidden; 
    margin: 0px; 
    padding: 0px; 
    border: medium none; 
} 

table.subTable td { 
    border-width: 0px; 
    padding: 0px; 
    margin: 2px; 
} 

.ui-slottable table { 
    height:100%; 
    width:100%; 
} 

.ui-slottable-slot { 
    width:100%; 
    height: 100%; 
    border-radius: 5px; 
    border-width:1px; 
    border-style:solid; 
    border-color: #cccccc; 
    background-color:#eeeeee; 
    border-collapse: separate; 
} 

</style> 
</head> 
<body> 
    <div class="ui-slottable"> 
     <table> 
      <tbody> 
       <tr> 
        <td> 
         <div class="ui-slottable-slot"> 

          <table class="subTable" style="margin:2px;"> 
           <tbody> 
            <tr> 
             <td>T1 Hallo</td> 
            </tr> 
           </tbody> 
          </table> 

         </div> 
        </td> 
        <td> 
         <div class="ui-slottable-slot"> 

          <table class="subTable"> 
           <tbody> 
            <tr> 
             <td>T2 Hallo</td> 
            </tr> 
            <tr> 
             <td>Halloggggggggggggggggggg</td> 
            </tr> 
           </tbody> 
          </table> 

         </div> 
        </td> 
       </tr> 
      </tbody> 
     </table> 
    </div> 
</body> 

</html> 

在這個文件字段T1應該有高度相同的T2。

我已經測試了很多不同的方式的,但毫無效果......

希望有人能告訴我怎麼IE讓這個...

+0

就像一個說明,嵌入表格是不好的做法:http://webdesign.about.com/od/layout/a/aa111102a.htm – 2012-03-12 14:03:16

+0

這裏只是一個例子。 – Knox 2012-03-12 14:18:41

+0

啊好的。如果你有一些你需要幫助的特定代碼,它可能會更有益。就目前而言,我不知道如何分類你的問題!抱歉。 – 2012-03-12 14:19:44

回答

1

嘗試設置高度通常不起作用。

通過在T1的最裏面的表格中使用2行,您也可以獲得相同的字段高度。 (使用nbsp作爲額外行的內容。)然後刪除表格html標記中的style="margin:2px;"

+0

這與將高度設置爲一個固定值的方式相同,這是可行的。但修復它並不好...也許我必須寫一個解決方法... – Knox 2012-03-12 14:52:32