I have a table that looks something like this:
+----------------------+-------------------+
| This text is on the | This text is on |
| first column | the second column |
+----------------------+-------------------+
And I want it to look like this:
+----------------------------------+-----------------------------------+
| This text is on the first column | This text is on the second column |
+----------------------------------+-----------------------------------+
My table is longer than the screen and has many many lines, but this is the functionality I want from it. Is there a CSS property that can make this happen without truncating the text? If not could somebody point me to a javascript example on how to do this?
If you need wider browser support than
white-space: nowrapyou can use a pre tag. The css solution is nicer though so only usepreif you really have to:Obviously this will only work for simple html in your table cells, plus
pregenerally comes with it’s own default styling which you can get around with the following in CSS:Using
inheritcan be slightly less supported, so if you can it is best to actually define the style you want directly.