4

Is there a way to give HTML table width and height in millimeters?

<table border="1">
 <tr width="17mm">
        <td>gukgu</td>
        <td>gukgu</td>
 </tr>
</table> 

Is this works?

HaK
  • 141
  • 2
  • 4
  • 13

2 Answers2

6

Yes, you can set widths in millimetres. However, setting a width on a <tr> element usually doesn't do anything. Instead, consider adding this style to the table: width:17mm; table-layout:fixed

Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592
  • As the question title says “in HTML” and the question is tagged with “html” only, perhaps you should add that it cannot be done in HTML but can be done in CSS the way shown (though not accurately, as mentioned in comments). – Jukka K. Korpela Mar 08 '13 at 06:58
4

You can using css, however it is only recommended for print. For display on screen, you use em, px or %.

<table border="1">
 <tr>
        <td style="width: 17mm;">gukgu</td>
        <td style="width: 17mm;">gukgu</td>
 </tr>
</table>

See the manual

See a demo

Kermit
  • 33,827
  • 13
  • 85
  • 121
  • That's not really reliable, see http://www.w3.org/TR/CSS21/syndata.html#length-units , millimeters assume http://www.w3.org/TR/CSS21/images/pixel1.png (If you could edit this into your answer (also, the image kind of rocks) that would be great) – Benjamin Gruenbaum Mar 08 '13 at 02:35
  • That's why I cautioned with it being not recommended. – Kermit Mar 08 '13 at 02:37