views:

376

answers:

5

Greetings,

I've been trying to make a site work for half a day to no avail. IE8 is bad for my mental state.

So, there is a table looking like this:

<table width="100%">
<tr id="header">
 <td colspan="2"></td>
</tr>
<tr id="center">
 <td id="left" style="width: 201px"></td>
 <td id="mainpage" style="width: 100%"></td>
</tr>
</table>

In every browser (including IE7) apart from IE8 the "left" td is fine. In IE8 it exceeds the width according to the mainpage's content.

I'd post some screenshots but it's my first post here.

Any ideas whatsoever?

A: 

Are you sure it should be 100%

<table width="100%">

The table will be as large as its parent element. May be you should set a fixed width for the table:

<table width="600">
Sarfraz
The table resides in a div that fits the whole screen.
Bill
A: 

If you define a width to your table and to your first you don't need to define it for your second .

I guess the second gets 100% from container which is the table.

Kaaviar
+1  A: 

That width: 100% on the second column doesn't look right - if you're trying to make the second column expand to the rest of the available space, you shouldn't need that at all, so you can remove it. Also, add this to your table:

table-layout: fixed;

to make sure that the widths are obeyed.

complete code:

<table style="width: 100%; table-layout: fixed;">
<col width="201" /><col />
<tr id="header">
 <td colspan="2"></td>
</tr>
<tr id="center">
 <td id="left"></td>
 <td id="mainpage"></td>
</tr>
</table>
Razor
Thought about this and gave it a try, but once I set the table-layout to fixed the two columns get the same width (50%) and it ignores the fixed values.The 100% of the second column is there as a fix for IE7.
Bill
Please try the edited solution with added cols - not a terribly cool solution but it works.
Razor
Indeed it does! Seems better than my solution, I'll go with that.Thanks!
Bill
A: 

Well, problem somewhat fixed by adding an empty table with a fixed width inside the mainpage .

That way I'm actually setting a min-width to the regardless IE's ignoring attitude. Thanks for all the answers.

Bill
A: 

I really think us, developers should stop to support IE's erradic behaviors and clearly write notes to the page stating: sorry guys but you should use a real browser. After all, you wouldn't drive a car which' break and accelerator pedals have been reversed either. Coping with IE's frakked up behavior has cost the industry millions of dollars!

Lawrence
I agree to some extend. In a personal site I made a while ago (IE6 nightmerish era) I had the the following line at the loading page:"This site will not work on Internet Explorer 6 which is a BAD BAD browser and it should die."However you can't expect a client to go along with something like that. I guess being patient is all we can do.
Bill