HTML Span Tag – Tutorialpath

HTML – <span> Tag

The <span> tag is used to group inline-elements in a document and content.

It used to group elements for styling purposes (by using the class or id attributes), A better way to use it when no other any other semantic element is available.

Span is very similar to the div tag, but div is a block-level Element tag and span is an inline tag.

The <span> tag provides a way to add a hook to a part of a text or a part of a document.

Syntax:

 

 

Example:

 

 

Output:

Tips

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

Global Attributes

The <span> tag also supports the Global Attributes in HTML.

Event Attributes

The <span> tag also supports the Event Attributes in HTML.

Leave a Reply

Your email address will not be published.