Introduction to Span in HTML
In HTML, the <span> tag is used to group inline-elements in a document. It does not add any extra space and is typically used to style a part of the text or to group inline elements for JavaScript or CSS purposes.
Usage of Span Tag
The span element is very useful when you want to apply a style to a particular section of the text. It can be used with CSS to apply styles such as color, font, background color, etc. Additionally, it can be used to target inline elements for JavaScript manipulation.
Attributes of Span Tag
The <span> tag supports the global attributes in HTML along with the event attributes that can be used with JavaScript. It does not have any specific attributes of its own.
Example Code
<p>This is a paragraph with some text and a <span style='color:red'>colored</span> word.</p>