How to set colspan to span all columns with HTML?

Spread the love

Sometimes, we want to set colspan to span all columns with HTML.

In this article, we’ll look at how to set colspan to span all columns with HTML.

How to set colspan to span all columns with HTML?

To set colspan to span all columns with HTML, we set the colspan attribute to 100%.

For instance, we write

<table>
  <tr>
    <td>ay</td>
    <td>bee</td>
    <td>see</td>
  </tr>
  <tr>
    <td colspan="0">colspan="0"</td>
  </tr>
  <tr>
    <td colspan="1">colspan="1"</td>
  </tr>
  <tr>
    <td colspan="3">colspan="3"</td>
  </tr>
  <tr>
    <td colspan="100%">colspan="100%"</td>
  </tr>
</table>

to set the colspan attribute to 100% in the last row to make the td span all the columns.

Conclusion

To set colspan to span all columns with HTML, we set the colspan attribute to 100%.

Leave a Reply

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