2013-01-05 34 views
1

我正在使用下面的代碼來定位表。它在firefox和chrome中顯示效果很好,但桌面會粘到Internet Explorer 9的左邊緣,但它應該在右邊。有人可以建議對此代碼進行一些修改,以便在Internet Explorer中正確顯示它嗎?如何在ie 9中使用css來定位表格?

HTML代碼:

<table class="tab1"> 
<thead> 
<tr>  
<th scope="col" id="Dimension"><strong>DIMENSIONS</strong></th> 
<th scope="col" id="Feet"><strong>FEET</strong></th> 
</tr> 

</thead> 
</tbody> 
<tr class="disp-Sing-Spc 
"> 
<th class="color1" scope="col">A (Distance Between Signs)</th> 
<th class="color1" scope="col" id="A">100</th> 
</tr> 
<tr class="disp-Sing-Spc 
"> 
<th class="color2" scope="col">B (Distance Between Signs)</th> 
<th class="color2" scope="col" id="B">100</th> 
</tr> 
<tr class="disp-Sing-Spc 
"> 
<th class="color1" scope="col">C (Distance Between Signs)</th> 
<th class="color1" scope="col" id="C">100</th> 
</tr> 
<tr id="disp-Tpr-Len"> 
<th class="color2" scope="col">L (Taper Length)</th> 
<th class="color2" scope="col" id="Tpr-Len">None</th> 
</tr> 
<tr class="disp-cn-spc 
"> 
<th class="color1" scope="col">Maximum Taper Channelizing Device Spacing</th> 
<th class="color1" scope="col" id="max-taper-dv-spcing">None</th> 
</tr> 
<tr class="disp-cn-spc 
"> 
<th class="color2" scope="col">Suggested Taper Channelizing Device Spacing</th> 
<th class="color2" scope="col" id="Sugg-tpr-dev-spcing">None</th> 
</tr> 
<tr class="disp-cn-spc 
"> 
<th class="color1" scope="col">Maximum Tangent Channelizing Device Spacing</th> 
<th class="color1" scope="col" id="Max-Tgt-dev-Spcing">None</th> 
</tr> 
<tr class="disp-cn-spc 
"> 
<th class="color2" scope="col">Suggested Tangent Channelizing Device Spacing</th> 
<th class="color2" scope="col" id="Sugg-Tgt-dev-Spcing">None</th> 
</tr> 
<tr> 
</tbody> 

</table> 

CSS代碼:

.tab1{ 
border-collapse: collapse; 
position: absolute; 
right: 2%; 
top: 95px; 
width: 25%; 
background: #EA9949; 
} 

回答

-1

在我的IE9它看起來不錯,但沒有2%右頁邊距。你應該嘗試浮動你的div並使用固定值。

.tab1{ 
border-collapse: collapse; 
position: absolute; 
right: 30px; 
float:right; 
top: 95px; 
width: 300px; 
background: #EA9949; 
} 

順便說一下,您應該讀取表格並使用div代替。

+0

這個答案似乎並不奏效:http://jsfiddle.net/8q6bG/,你應該在發佈你的答案之前嘗試一下。 – Josep

+0

在你上次編輯時,它的工作原理是因爲你改變了寬度值,它將在沒有「float」的情況下工作,這不會回答這個問題。 – Josep

+0

非常感謝,使用固定值爲我工作.... – user1944257