html tutorial - span Attribute in HTML - html5 - html code - html form

Span attribute in html

Learn html - html tutorial - Span attribute in html - html examples - html programs

  • The span attribute specifies the number of columns a <col>/<colgroup> element to be span.

Syntax for span attribute in HTML:

<col span="number">

Applies To:

Element Attribute
<col> span
<colgroup> span

sizes Attribute Values:

Value Description
number Defines the number of columns.

Sample Coding for span Attribute in HTML:

Tryit<!DOCTYPE html>
        <title>Wikitechy span attribute</title>
        <table border ="1">
            <col span="2" style="background-color: red">
            <col style="background-color: green">
            <td>[email protected]</td>
            <td>[email protected]</td>

Code Explanation for span Attribute in HTML:

span Attribute Code Explanation

  1. The <col> tag is used to specifies a column functionalities for every column
  2. span is an attribute, which describes the number of columns. (Here style color red is applied for two column with its span property as 2.)

Output for span Attribute in HTML:

span Attribute Output

  1. Here in the output Red Color style property for two columns because span property is set to “2”.
  2. The red color is displayed in the output for Learn our Creative step by step HTML5 tutorials library.

Browser Support for span Attribute in HTML:

Yes Yes Yes Yes Yes

Related Searches to span Attribute in html