To set the cell width and height, use the CSS style. The height and width attribute of the <td> cell isn't supported in HTML5. Use the CSS property width and height to set the width and height of the cell respectively.
CSS Table Row height. You can set Row Height through CSS line-height property it set to each tr. When you set this property, each row has heigh of 50 pixel.
From the Table menu, select “Table Properties.” Click on the Table tab, then the Options button. Uncheck “Automatically resize to fit contents.” Click “OK.” Now click on the “Row” tab in Table Properties. Make sure that “Specify Height” is checked and the size in the middle box is the height you want your rows to be.
Set a row to a specific height Select the row or rows that you want to change. On the Home tab, in the Cells group, click Format. Under Cell Size, click Row Height. In the Row height box, type the value that you want, and then click OK.
try this:
.topics tr { line-height: 14px; }
try setting the attribute for td
so:
.topic td{ height: 14px };
I found the best answer for my purposes was to use:
.topics tr {
overflow: hidden;
height: 14px;
white-space: nowrap;
}
The white-space: nowrap
is important as it prevents your row's cells from breaking across multiple lines.
I personally like to add text-overflow: ellipsis
to my th
and td
elements to make the overflowing text look nicer by adding the trailing fullstops, for example Too long gets dots...
You can remove some extra spacing as well if you place a border-collapse: collapse;
CSS statement on your table.
line-height only works when it is larger then the current height of the content of <td>
. So, if you have a 50x50 icon in the table, the tr
line-height will not make a row smaller than 50px (+ padding).
Since you've already set the padding to 0
it must be something else,
for example a large font-size inside td
that is larger than your 14px.
As for me I decided to use paddings. It is not exactly what you need, but may be useful in some cases.
table td {
padding: 15px 0;
}
If you are using Bootstrap, look at padding
of your td
s.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With