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%;">
</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?
To set the table width in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <table> tag, with the CSS property width.
The width of the columns i.e. td in a table can be fixed very easily. This can be done by adding the width attribute in the <td> tag. If the width is not specified, the width of the column changes according to the change in the content. The specifications of width for the columns can be in pixels, or percentage.
To manipulate the height or width of an entire table, place the size attribute (either "WIDTH=" or "HEIGHT=") within the <TABLE> code. To manipulate individual cells, place the size attribute within the code for that cell.
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
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With