Span Tag in HTML5

In this article I am going to describe how to use Span Tag in HTML5.
  • 1838

Span Tag

<span> tag is used to group in-line elements in a document.

The difference between <span> tag and the <div> tag is that the <span> tag is used with inline elements whereas <div> tag is used with block level content. The <span> tag supports in both HTML5 and HTLM4.01. It is used for grouping inline elements. It is nothing without global attributes.The <span> tag is use for specifying a section in a document.

Note: When a text is hooked in a <span> element, you can style it with CSS, or manipulate it with JavaScript.

Browser Support

It is supported in all major browsers.

Syntax

The syntax is given below:

<span>....</span>

Example of <span> tag in HTML5

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">

<head>

    <meta charset="utf-8" />

    <title>Colgroup in HTML5</title>

</head>

<body>

    <h3>Implementation of Span Tag in HTML5</h3>

    <p>

        He is a <span style="color: lightblue; font-weight: bold">Software Engineer</span>.He is having<br>

        good knowledge of <span style="color: red; font-weight: bold">Programming Languages</span>such as<br>

        <span style="color: blue; font-weight: bold">Java,Oracle,c#,Asp.Net,PHP</span>

    </p>

</body>

</html>

Output

span.jpg

© 2020 DotNetHeaven. All rights reserved.