I've got a HTML table that has four columns of data, retrieved from a SQL database. The table is styled with CSS to be the full width of the page. The first and third columns are of a fixed size. I want the other two columns to change size with the table but for the two variable width columns to always be the same size.
I've used these styles for columns 1 and 3 (the fixed widths) and the table:
.column1
{
min-width: 120px;
width: 120px;
}
.column3
{
min-width: 140px;
width: 140px;
}
.mytable
{
width: 100%;
}
I haven't set any styles for the two variable width columns. I find that in Firefox the table works as expected but in Internet Explorer the two variable width columns change size depending upon what text is present in the rows.
How can I keep the two variable columns the same width?
EDIT
Not sure i开发者_如何学Cf it's worth mentioning but some data crosses multiple columns with colspan="3". This isn't alwyas the case though and the table sizes in the same way whether such a row is present or not. The intention is to create a layout that matches that of a form in Microsoft CRM 4.0. A mix of four columns and two columns (colspan=3 on second column) and rows that can vary in height. It also means that this only needs to work in IE.
Since the width of your table is defined as a percentage, you might consider making .column1 and .column3 a percentage as well. This will then help you define the widths of the two remaining columns.
精彩评论