Categories
CSS

How to set up fixed width for td with CSS?

Spread the love

To set up fixed width for td with CSS, we set the width property.

For instance, we werite

<tr>
  <th style="width: 16.66%">Col 1</th>
  <th style="width: 25%">Col 2</th>
  <th style="width: 50%">Col 4</th>
  <th style="width: 8.33%">Col 5</th>
</tr>

to set the width of each th element to the width we want with the width property.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *