<span>
<span>
Tag
The <span>
tag in HTML is an inline container used to group elements or apply styles without introducing a new block-level structure. It does not modify content presentation on its own but allows CSS styling or JavaScript functionality to be applied to specific text or inline elements.
Syntax
<span>Text or elements to style</span>
<span>
Demo
My mother has red eyes, and my father has dark green eyes.
<h1>The <span> element</h1>
<p>My mother has <span>blue</span> eyes, and my father has <span>dark green</span> eyes.</p>
Attributes
- This element supports all the attributes.
Definition and Usage
- The
<span>
tag serves as an inline container to style or emphasize portions of text or content within a document. - It can be styled with CSS or manipulated using JavaScript by applying
class
orid
attributes. - Unlike the
<div>
element, which is block-level,<span>
remains inline.
Default CSS Settings
- None.
See Also
<div>
elementConclusion
The <span>
tag is a versatile inline container that allows developers to style or manipulate specific portions of text or inline elements without affecting the document's layout. It is commonly used for applying CSS styles or JavaScript functionality to targeted content. Unlike block-level elements, <span>
does not introduce line breaks, making it perfect for inline styling.
<section>
The HTML <section> element represents a thematic block of content, usually containing its own heading, used to organize and divide a document into related segments.
<article>
The HTML <article> element defines a standalone, self-contained piece of content, like a blog post or news article, which can be independently distributed or syndicated.