Search code examples
htmlcsshtml-tableinternet-explorer-8internet-explorer-7

IE doesn't recognize TD width?


I wonder why IE doesn't seem to recognize the width I specify?

Basically I have this code:

<table>
   <tr>
    <td valign="top" align="right" class="left_frame"></td>
   </tr>
</table>

CSS:

.left_frame {
    background: url(images/side.gif) repeat-y; 
    width: 17px; 
}

Even if I add width="17" inside the <td></td> tags, the width still doesn't change. This is quite frustrating because the problem seems to be very simple.


Solution

  • I'd say it's because there's no content in your <td>

    Try adding a &nbsp; in there so the cell has some content, and see how that goes.

    Alternatively, placing a height on the cell may work as well, depending on your requirements.

    Basically the cell is a flat line at the moment, and needs something to tell it how tall it is, in order to draw the background in.

    Example: http://jsfiddle.net/MvBf5/