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





Related Articles
What is HTML Block and Inline Elements HTML Block and Inline Elements
How to create HTML Block-level Elements HTML Block and Inline Elements
How to create HTML Inline Elements HTML Block and Inline Elements
How to crearte The <div> Element in HTML HTML Block and Inline Elements
How to create The <span> Element in HTML HTML Block and Inline Elements

Single Articles
Basic Example of The <span> Element in HTMLHTML Block and Inline Elements
Full Example of The <span> Element in HTMLHTML Block and Inline Elements

Read Full:
HTML Block and Inline Elements
Category:
Web Tutorial
Sub Category:
HTML Block and Inline Elements
Uploaded:
1 year ago
Uploaded by:
Admin
Views:
77


Reffered: https://www.w3schools.com/html/tryit.asp?filename=tryhtml_span

Share on: