开发者

HTML Table th style width not working

I have a table like so:

<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>

Now the column widths are set correctly to the percentages in IE, but not in firefox. (Probably FF doing something correctly)

Is there something I can do to get the widths of the columns to be fixed to the above percentages in both IE and FF?


add

style="width: 100%;"

to the table


You've set the percentages to be percentages, but percentages of what?

Try setting the width of the table itself, either using style="width: x" or in the CSS with:

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


try adding a 100% width to the table..


I can't replicate the percentages being correctly set in IE, FF or Chrome. To get the percentages set correctly you must set a width to the outlying table. Whether that is an absolute or relative value is up to you. But remember not to use inline styles.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜