max-width: ***; min-width: ***;
Browser |
|
---|
The max-width property specifies the maximum width of an element, and the min-width property specifies the minimum width of an element.
The maximum width and minimum width of the table can be specified by applying these properties to the TABLE element.
table {
max-width: 500px;
min-width: 400px;
}
Property | Value | Explanation |
---|---|---|
max-width | length, %, or none | the size of the maximum width (the default is none) |
min-width | length or % | the size of the minimum width |
Example
<html>
<head>
<title>TAG index</title>
<style type="text/css">
table {
border: 2px #2b2b2b solid;
width: 100%;
max-width: 600px;
min-width: 500px;
}
td, th {
border: 2px #2b2b2b solid;
}
</style>
</head>
<body>
<p>minimum width:500px - maximum width:600px</p>
<table>
<tr>
<th>Heading A</th>
<th>Heading B</th>
</tr>
<tr>
<td>Cell A</td>
<td>Cell B</td>
</tr>
</table>
</body>
</html>
- Output
-
Example page