HTML span attribute

The span attribute allows an element to span more than columns for stylish purposes. span attribute can style one or more columns instead of cells one by one.

In the following example, the span attribute styles two columns.


Countries Population Area Capital
China 7,432,663,275 9,572,900 Beijing
India 1,382,323,332 3,287,263 New Delhi
Try </>

try HTML of the example to understand.

span attribute values

The value of span attribute is a valid positive integer.

Related Tags

The tags which support this attribute are as follows.

<col> tag

col element represents a column in a table. It takes part in making the structure of table. col tag is used as the child of the colgroup element.

See the above example.

<colgroup> tag

colgroup is used to group the columns. span attribute is applicable on the colgroup element.

Was this article helpful?




Get the newsletter