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




Scope attribute in html

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

  • The scope attribute defines whether a header cell is a header for a column, row, or group of columns or rows.

Syntax for scope attribute in HTML:

<th scope =”col|row|colgroup|rowgroup”>content</th>

Applies To:

Element Attribute
<th> scope

scope Attribute Values:

Value Description
col Defines that the cell is a header for a column
row Defines that the cell is a header for a row
colgroup Defines that the cell is a header for a group of columns
rowgroup Defines that the cell is a header for a group of rows

Sample Coding for scope Attribute in HTML:

Tryit<!DOCTYPE html>
<html>
    <body>
        <table border ="1">
        <tr>
            <th scope=”col”>Firstname</th>
            <th scope=”col”>Lastname</th>
        </tr>
        <tr>
            <td>Wiki</td>
            <td>techy</td>
        </tr>
        <tr>
            <td colspan="10">Fullname: Wikitechy</td>
        </tr>
        </table>
    </body>
</html>

Code Explanation for scope Attribute in HTML:

scope Attribute Code Explanation

  1. <table> element - is used to define the data in the table format. border is the attribute that shows border around the table.
  2. <tr> element – used to represents the row of the table.
  3. <th> element – used to represents the header of the table.
  4. scope attribute specifies whether the heading is associated with a row or a column.

Output for scope Attribute in HTML:

scope Attribute Output

  1. The scope attribute does not have a visual effect in web browsers, but they read by search engines or screen readers.

Browser Support for scope Attribute in HTML:

Yes Yes Yes Yes Yes

Related Searches to scope attribute in html