span(HTML attribute)

Syntax

span="number (of columns spanned)"

Description

Just as you can set
th and td elements to span multiple
columns using the colspan attribute, a similar
result can be achieved with the col element using the
span attribute (notcolspan —after all, it’s obvious that it’s a
col that’s being spanned!). However, using this
attribute doesn’t cause any cells to be merged (as does
colspan). Rather, it tells the browser how many
columns or cells the attributes set in the col should
apply to (including the first col). So, in the HTML
example we have a table with four cells in each row—and, therefore, four
columns. But only two col elements are defined, with
span attributes of "2".

Example

Here, the
span is used to group the first two columns
separately from the second two columns, and each group is given a
different class for styling
purposes:

Value

This attribute takes as its value a
number that represents the number of consecutive cells to which the
col attributes should apply.

Compatibility

Internet Explorer

Firefox

Safari

Opera

Chrome

5.5

6.0

7.0

8.0

1.0

1.5

2.0

3.0

3.5

1.3

2.0

3.1

4.0

9.2

9.5

10.0

2.0

Full

Full

Full

Full

Full

Full

Full

Full

Full

Full

Full

Full

Full

Full

Full

Full

Full

Support for this
attribute has been marked as full, but be aware that this support depends
on whether the other attributes are supported. For instance, Safari
ignores the align attribute, so asking it to span
that attribute across two columns will have no effect. In short, the
successful rendering of span depends on the support
for the attributes with which it’s associated.