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>
<html>
    <head>
        <title>Wikitechy span attribute</title>
    </head>
    <body>
        <table border ="1">
        <colgroup>
            <col span="2" style="background-color: red">
            <col style="background-color: green">
        </colgroup>
        <tr>
            <th>FName</th>
            <th>LName</th>
            <th>E-mail</th>
        </tr>
        <tr>
            <td>Wikitechy</td>
            <td>tutorials</td>
            <td>[email protected]</td>
        </tr>
        <tr>
            <td>HTML</td>
            <td>tutorials</td>
            <td>[email protected]</td>
        </tr>
        </table>
    </body>
</html>

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