Link to home
Start Free TrialLog in
Avatar of Tolgar
Tolgar

asked on

How to limit the width of a column and left align in HTML?

I have the following table in HTML.

The width of each column changes with the content of the longest cell.

How can I make the column width fixed and left align each cell?

<html>
<table>
<p>
<table border="1">
<thead align="center" style="padding:8px" bgcolor="#FFEFD5">
<tr bgcolor="lightyellow">
<th>Column1</th>
<th>Column2</th>
<th>Column3</th>
</thead>
<tbody>
<th rowspan="2">a</th>
<td>b</td><td>d</td></tr>
<td>c</td><td>e</td></tr>
</tbody>
</table>
</html>

Open in new window

Avatar of Gary
Gary
Flag of Ireland image

th {
width:100px
}
th,td {
text-align:left
}
Avatar of Tolgar
Tolgar

ASKER

Could you please insert it into my code?

Thanks,
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tolgar

ASKER

Thank you. But this changes all column widths.

Is it possible to change only the first and the second column widths?

Thanks,
Avatar of Tolgar

ASKER

ok. I got it.

I put the width inside td tags.

Thanks,