2012-02-20 98 views
0

由於某些原因,我的表格不會顯示在IE7中。 一個例子表看起來像這樣:表格不會顯示在ie7

<table class="stringingTable"> 
<tbody> 
<tr> 
<td class="selected">.</td> 
<td>,</td> 
<td>and</td> 
<td>also</td> 
<td>but</td> 
<td>however</td> 
<td>whereas</td> 
</tr> 
</tbody> 
</table> 

相關的CSS是這樣的:

stringingTable { 
    position: relative; 
    width: 70px; 
    height: 30px; 
    background: #9A2F00; 
    text-align: center; 
    font-size: 0.8em; 
    line-height: 1em; 
    cursor: pointer; 
    cursor: hand; 
} 

.stringingTable td.selected { 
    display: table-cell; 
} 

.stringingTable td { 
    word-wrap: break-word; 
    max-width: 70px; 
    display: none; 
} 

下表顯示了在所有現代瀏覽器不錯,但,這是對教師在NI網站(誰所有使用IE7,因爲他們使用C2k

+1

一個不會簡單地爲IE7設計一個網頁。 – 2012-02-20 17:30:15

+0

試過'zoom:1'? – powerbuoy 2012-02-20 17:30:30

+0

我的意思是設計一個與IE7兼容的網頁。 放大:1什麼都不做 – 2012-02-20 17:33:37

回答

1

小於8的Internet Explorer版本不支持CSS表格顯示屬性,其中包括table,inline-table以及table-*的所有屬性。不幸的是,通過將這些單元格設置爲display: none,您將無法在不更改表格外觀的情況下重新顯示它們(因爲您不能將它們設置爲返回到表格單元格)。

我不知道它是否會對您的具體情況有所幫助,但您可以嘗試使用visibility: hiddenvisibility: visible來代替。

+0

好的,謝謝你的幫助。我決定使用javascript函數來將div中的內聯元素垂直居中,而不是使用表格單元格 – 2012-02-20 21:58:13

0

您正在使用display: none;所有TD s,所以你隱藏了一切。如果我不刪除display: none,它不會顯示在Chrome中。

+0

top td的class .selected被設置爲display:table-cell; – 2012-02-20 17:37:31