HTML style width table not working

I have a table like:

<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 width is set correctly for percent in IE, but not in firefox. (Maybe FF is doing something right)

Is there something I can do to get the width of the columns to fix the above percentages in IE and FF?

+8
html html-table width
source share
4 answers

add

style = "width: 100%;"

to table

+3
source share

You indicated percentages in percent, but percentages of what?

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

 table#MyTable { width: x; // x denotes overall size } 
+2
source share

try adding 100% width to the table.

0
source share

I cannot replicate percentages set correctly in IE, FF or Chrome. To set percentages correctly, you must set the width to the table. Whether it is absolute or relative value is up to you. But don't forget to use inline styles.

0
source share

All Articles