Home » What does span do in Html

What does span do in Html

by Online Tutorials Library

What does span do in Html

The span is a tag in Html. Html <span> tag is used for grouping the inline elements and applying the style to them. This tag applies the styles by using the class or id attributes. This tag is similar to the Html <div> tag, but it is an inline tag. This tag is used at that time when there is no other semantic tag is present to use.

<span> tag is a paired tag, i.e., it has open as well as close tag, so it is mandatory to close this tag.

We can easily understand the <span> tag by the examples. So, we will provide the following various examples.

Example 1: The following example uses the span tag with the inline style attribute.

Test it Now

The output of above Html code is shown in the following screenshot:

What does span do in Html

Example 2: The following example uses the span tag with the internal CSS.

Test it Now

The output of above Html code is shown in the following screenshot:

What does span do in Html


You may also like