2011-03-08 81 views
8

我有一个表,像这样:HTML表级风格宽度不工作

<table id="MyTable" cellspacing="0" cellpadding="0"> 
    <thead> 
     <tr> 
      <th style="width: 30%;"> 
       <asp:Literal ID="LitDescriptionTitle" runat="server" /> 
      </th> 
      <th style="width: 30%;"> 
       <asp:Literal ID="LitDescription2Title" runat="server" /> 
      </th> 
      <th style="width: 30%;"> 
       <asp:Literal ID="LitAddressTitle" runat="server" /> 
      </th> 
      <th style="width: 10%;"> 
       &nbsp; 
      </th> 
     </tr> 
    </thead> 
<tbody> 

现在列宽被正确地设置在IE百分比,但不是在Firefox。 (可能FF做正确的事情)

有什么我可以做的,以获得固定在IE和FF的上述百分比列的宽度?

回答

3

添加

风格= “宽度:100%;”

0

尝试添加100%的宽度表..

0

我不能复制该百分比在IE,FF或Chrome正确设置。要正确设置百分比,您必须将宽度设置为偏离表。这是绝对的还是相对的价值取决于你。但请记住不要使用内联样式。

2

您已将百分比设置为百分比,但百分比是什么?

尝试设置表本身的宽度,或者使用style="width: x"或在CSS与:

table#MyTable { 
    width: x; // x denotes overall size 
}