0

For some odd reason IE is ignoring my column widths and just setting all six columns to equal widths.

table{
table-layout: fixed;
} 

<colgroup>
        <col style="width: 15%;" />
        <col style="width: 40%;"/>
        <col style="width: 5%;" />
        <col style="width: 10%;" />
        <col style="width: 10%;" />
        <col style="width: 20%;" />
    </colgroup>
Sean Keane
  • 411
  • 1
  • 6
  • 19
  • That's a statement not a question. I assume the question is how to fix it. – bjb568 Jan 29 '14 at 22:25
  • 3
    You must be new to web development. Nothing works in –  Jan 29 '14 at 22:26
  • Not new, just have to get it working in IE 8. My entire user base is still stuck on IE 8 for the moment. And yes the question is how to fix it. Any ideas? – Sean Keane Jan 29 '14 at 22:40

3 Answers3

4

Short answer: Because IE sucks

Long answer: Use <table>, <tr> and <td> instead. And use the colspan attribute to achieve the same effect.

Mohamed Khamis
  • 7,731
  • 10
  • 38
  • 58
0

Sean you can use the <td> tag for styling your various widths, correct, but I don't see any issues with the code you are using now, provided the <colgroup> designation is placed in the proper placement relative to the <table> tag as follows:

<table style="border:1px solid #000; table-layout:fixed;">
  <colgroup>
     <col style="width: 25%;" />
     <col style="width: 65%;" />
     <col style="width: 10%;" />
  </colgroup>
  <tr>
    <th>ISBN</th>
    <th>Title</th>
    <th>Price</th>
  </tr>
  <tr>
    <td>3476896</td>
    <td>My first HTML</td>
    <td>$53</td>
  </tr>
  <tr>
    <td>5869207</td>
    <td>My first CSS</td>
    <td>$49</td>
  </tr>
</table>

IE 8 apparently doesn't play nicely with jsfiddle, so I dumped the code into one of those W3C sandboxes to test. Just go to that link in IE 8 and replace their colgroup section with what I have above, and hit the "submit code" button to view results.

code-sushi
  • 719
  • 3
  • 7
  • 23
0

Although you may already have come across this site and this note regarding IE8, those should be very helpful if you review them again in detail.

IE8 is relatively incompatible web browser when it comes to parsing CSS.

This limitation in IE8 becomes woefully salient when anyone tries to do sizing of any kind, be it windowing or table-sizing.

As indicated in one of the web-sites I mentioned above, you could try to complement IE8 with JavaScript instead of relying heavily on HTML and CSS only.

Community
  • 1
  • 1