Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML Table width in IE?

I am using table to display a set of data, my HTML code goes here...

<table border="1" cellspacing="0" cellpadding="0" style="width: 780px;">
  <tbody>
    <tr>
      <td style="width: 780px; height: 25px;">
        <pre width='100' style='width: 780px; word-wrap: break-word;'>
            the data goes here.....
        </pre>            
      </td>
    </tr>
    <tr>
      <td style="width: 780px; height: 25px;">
        <pre width='100' style='width: 780px; word-wrap: break-word;'>
            the data goes here.....
        </pre>            
      </td>
    </tr>
  </tbody>
</table>

this table works ok in firefox, safari, and IE8. But the problem arise in IE7, IE6.. asthe table expands and goes out of the screen(i.e expands towards right hand side in x-axis).... is there any hack to fix it?

the screen shots of IE6 in IETester:

enter image description here

like image 211
Harish Kurup Avatar asked Jun 14 '10 06:06

Harish Kurup


1 Answers

Use the CSS below and this should prevent your table exceeding the maximum size you define:

table{
  table-layout:fixed;
}
like image 147
Pete Avatar answered Sep 20 '22 17:09

Pete