HTML Tutorial
<span>
The HTML <span>
tag is an inline element used to group or style a portion of text. It does not affect the document's structure but provides additional semantic or visual cues.
<span>
id
: Unique identifier for the <span>
element.class
: CSS class name(s) to apply styling.title
: Tooltip or descriptive text for screen readers.style
: Inline CSS styles.<span>
<span style="color: red;">This text is highlighted.</span>
<span style="margin: 5px;">This text has extra spacing.</span>
<span style="cursor: pointer;">This text changes the cursor to a pointer.</span>
Exploring the <span>
Tag
<p>
This is a paragraph of text.
<span style="color: green;">This is a green span.</span>
</p>
Output:
This is a paragraph of text. This is a green span.
In this example, the <span>
tag is used to add green color to a portion of the text within the paragraph, highlighting it visually.