Horje
How to create The <span> Element in HTML

The <span> element is an inline container used to mark up a part of a text, or a part of a document.

The <span> element has no required attributes, but style , class and id are common.


Basic Example of The <span> Element in HTML

<p>My mother has <span style="color:blue;font-weight:bold;">blue</span> eyes and my father has <span style="color:darkolivegreen;font-weight:bold;">dark green</span> eyes.</p>

Full Example of The <span> Element in HTML

When used together with CSS, the <span> element can be used to style parts of the text:
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>
<h1>The span element</h1>
<p>My mother has <span style="color:blue;font-weight:bold;">blue</span> eyes and my father has <span style="color:darkolivegreen;font-weight:bold;">dark green</span> eyes.</p>
</body>
</html>

Output should be:

Full Example of The <span> Element in HTML





Category :
Web Tutorial
Sub Category :
HTML Block and Inline Elements
Uploaded by :
Admin


Read Article
https://horje.com/learn/1434/reference