width: ***; height: ***;
Browser |
|
---|
The width property specifies the width of an element, and the height property specifies the height of an element.
The width and height of the cells can be specified by applying these properties to the TD or TH elements.
td {
width: 100px;
height: 50px;
}
Property | Value | Explanation |
---|---|---|
width | length, %, or auto | the size of the width |
height | length, %, or auto | the size of the height |
The default is "auto".
Example
<html>
<head>
<title>TAG index</title>
<style type="text/css">
table, th, td {
border: 2px #2b2b2b solid;
}
td {
height: 100px;
}
#example1 { width: 100px; }
#example2 { width: 200px; }
</style>
</head>
<body>
<table>
<tr>
<th id="example1">Heading A</th>
<th id="example2">Heading B</th>
</tr>
<tr>
<td>Cell A</td>
<td>Cell B</td>
</tr>
</table>
</body>
</html>
- Output
-
Heading A Heading B Cell A Cell B