Mori
Mori

Reputation: 6850

Set a table columns width

I tried to do it by adjusting the width:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Sample Page</title>
<style type="text/css">
div {width:100%; overflow:auto;}
table, td {border:1px solid #000;}
td {width:1000px;}
</style>
</head>
<body>
<div>
<table>
<tr>
<td>First cell</td>
<td>Second cell</td>
<td>Third cell</td>
</tr>
<tr>
<td>Forth cell</td>
<td>Fifth cell</td>
<td>Sixth cell</td>
</tr>
</table>
</div>
</body>
</html>

But it didn't work. What am I missing?

Upvotes: 0

Views: 161

Answers (1)

CFL_Jeff
CFL_Jeff

Reputation: 2719

Your table layout must be fixed for your columns widths to be fixed:

<table style="width: 100%; table-layout: fixed;">

Upvotes: 1

Related Questions