开发者

Table-Laout:fixed rendering different in IE6/7 then IE8/Chrome/FF

开发者 https://www.devze.com 2022-12-29 14:47 出处:网络
Basically I want the column widths on a table to ignore the size of the data. Excess data can be cutoff. Right now it is stretching the width of my columns even though I\'m using table-layout:fixed. M

Basically I want the column widths on a table to ignore the size of the data. Excess data can be cutoff. Right now it is stretching the width of my columns even though I'm using table-layout:fixed. My expected behavior works in IE6 and 7 but not in anything else. Further if I remove my DTD then it will work just fine in IE8 but still not what I expect in FF/Chrome.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <body>
    <table border="1" cellspacing="0" cellpadding="5" style="table-layout:fixed;overflow:hidden;">
        <tr>
          开发者_StackOverflow  <td width="50">
                -1,610,612,736.00
            </td>
            <td width="50">
                222
            </td>
        </tr>
        <tr>
            <td>33</td>
            <td>44</td>
        </tr>
    </table>
    </body>
</html>

Basically I want to have that long negative number be on 1 line and have the overflow cut off rather then adjusting the width of the column.

thanks!


One way to get what you want is to put each of the values in a <div> inside the < td>s, then set a width and overflow:hidden on the <div>s.

Another is to set overflow:hidden on the < td>s and set a width for the table.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号