Forum:How to make template fields several lines high without explicit br?

For example, see this page, the unit template. Text in one of the fields ("Unique") is far longer than can fit into template's length. That makes texts of first column, which consist of several words, squish and become several lines high. That doesn't look beautiful, so is there any way from stopping text squish (first column)? I can explicitly write  every few words in long text, but that doesn't seem like a nice solution to me. Any help appreciated. voice (talk) 12:13, October 15, 2012 (UTC)


 * In your template (w:c:eon:Template:Unit), the code that makes a single row looks like this:




 * You can explicitly set the height of a row using CSS:


 * - style="height:44px"

's everywhere.
 * ^If you did that for all of the rows, it would make each of those rows have a minimum height of 44px on every page the template is used. You could improve upon that by making a "height" parameter for the template. That way if you want to set the height on a particular page, you can do so manually, which is a bit easier than putting


 * - style="height:"


 * This isn't the best solution maybe, but it's the simplest one I can think of off the top of my head that can adapt to varying heights. If you know ahead of time that ALL pages that use the template will never have more than 2 lines of text per row, you can use a fixed height value like "44px". But if the height would be different on different pages, you need the height parameter (or something similar).


 * What you want is to give the left column cells an explicit width that will force it to be as wide as you want and prevent the line-breaking. Tables are a pain with this, though. Tables don't obey widths and heights properly, treating them as suggestions rather than demands. If it doesn't work, stick " " on the table tag, but be aware that that will lock all of the table's widths so it won't grow wider on its own any more at all, that can cause other problems when you use long words that won't fit in its column properly (over-long words will spill [overflow] into adjacent columns, or out of the infobox, like they would in a fixed width DIV or any other element). Lunarity 03:27, October 16, 2012 (UTC)
 * Thanks for answers!
 * What you want is to give the left column cells an explicit width that will force it to be as wide as you want and prevent the line-breaking. This is exactly what I want. But I am new to this, so can anyone tell me how exactly I do this? voice (talk) 15:18, October 16, 2012 (UTC)


 * The easiest way is to find out what the longest line is and put a  in front of it. However, this only works if that cell is shown in the template. To ensure that all cells conform to that, find one mandatory cell (one that should always show up) and put a   in front (adjust the width until it fits). For your template above, to accommodate the longest line "Defensive Capture", you'd need a width of at least 116px (120px for a nice padding). You can put that onto the first line for Faction, and it will adjust every cell underneath. Rappy 15:28, October 16, 2012 (UTC)
 * I finally did that. Thanks everyone! voice (talk) 15:59, October 16, 2012 (UTC)