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

HTML

Avatar of undefined
Last Comment
Tolgar

8/22/2022 - Mon
Gary

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

ASKER
Could you please insert it into my code?

Thanks,
ASKER CERTIFIED SOLUTION
Gary

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Tolgar

ASKER
Thank you. But this changes all column widths.

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

Thanks,
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Tolgar

ASKER
ok. I got it.

I put the width inside td tags.

Thanks,