Home Tutorials HTML Tutorial span Element
span Element

span Element


22. span Element

The <span> element is a generic inline container used to style or target part of text. Unlike <div>, it does not start on a new line.

Syntax

<span>Text</span>

Example

<p>This is <span style="color:red;">important</span> text.</p>

Output

The word important appears in red inside the paragraph.
Example

🏋️ Test Yourself With Exercises

Take our quiz on span Element to test your knowledge.

Browse Quizzes »