Topic on Project:Support desk

Jump to navigation Jump to search

Producing a table where only one column can word wrap

5
Vicarage (talkcontribs)

My users have been putting in nbsp   to stop parts of individual lines in a table from wrapping. What I'd like is to be able to add the CSS white-space: nowrap; to apply to particular columns in a table, allowing others to wrap, but all I've managed to do is apply the style line by line, which my users will never do. (I tried the 'nowrap' template, which they might adopt, but that doesn't seem to work, see previous topic.

My attempts so far can be seen at http://wiki.johnbray.org.uk/Tabletest

Vicarage (talkcontribs)
Bawolff (talkcontribs)

i dont think that mediawiki supports the colgroup html tag.

You might be able to do something fancy with nth-child if you have extension:TemplateStyles installed. E.g. table.classNameHere tr td:nth-child(2) {white-space: nowrap} or something

Vicarage (talkcontribs)

My SimpleTable.php change to convertTable


                if ($col < sizeof($fields)-1) {
                  $wikitab .= $cbar . ' <span style="white-space: nowrap;">' . $field . "</span>\n";
                } else {
                  $wikitab .= $cbar . " " . $field . "\n";
                }
Bawolff (talkcontribs)

Note, that the SimpleTable extension has an XSS vulnerability in it.

Reply to "Producing a table where only one column can word wrap"