• 0

Table overflowing ...


Question

Hey - I have a fixed width <td> element...

Currently, when text is inputted that would go past the border of the element, it stretches the entire column, even though the width is set explicitly. Eg.

&lt;td width="50"&gt;WEeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&lt;/td&gt;

I know that there is the "overflow-x" property in CSS, but this only works for Internet Explorer and is not standard. Is there any other method I could use? Thanks for any help :)

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

It's all in the W3C standard spec for CSS...

Overflows

Table Cell Widths

Try overflow: auto or overflow: scroll. I also have plenty of links in my sig that show what the standard HTML/CSS properties are.

Since you're using CSS, I recommend that you either use it fully or not use it all. The last thing you want is to mix old and new coding styles. Mixing will only serve to overcomplicate your code and confuse you. For example if you stick strictly with CSS, your table cell widths should not be determined by tag attributes. It should instead be defined by CSS code.

For a more egregious example of what I'm talking about, you would not want to do something like this...

&lt;style type="text/css"&gt;
    table, td { border: 10px solid black; }
    td { width: 10em; }
&lt;/style&gt;
....
&lt;font style="font: bold Wingdings, serif;"&gt;
    &lt;i&gt;&lt;font face="Arial"&gt;&lt;b&gt;Non-ideal implementation&lt;/b&gt;&lt;/font&gt;&lt;/i&gt;
&lt;/font&gt;
....
&lt;table border="5"&gt;&lt;tr&gt;
&lt;td width="5"&gt;Ugh, why did I do this when CSS can do a much better job??&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
....

Link to comment
Share on other sites

  • 0

Thanks for the help :) I just realized I was using outdated versions of Netscape and Opera, which did not support the overflow feature, so when I upgraded both, overflow worked perfectly.

Oh also, my table's attributes are defined using CSS; the above was just a quick little example :D

Thanks again for the help, much appreciated !

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.