<span> Element

The <span> element is an inline element that acts as a container for encapsulating content.

 

CSS is generally applied to provide styling to a <span>, enabling the content contained with the span to be styled individually.

 

A span can only contain other inline elements, and cannot contain block-level children.

 

<span> only works on inline content and should not be used for setting the width.

 

<!DOCTYPE html>
<html>
	<head>
		<title>My Document Title</title>
	</head>
	<body>
		<h1>My first Heading</h1>
		<p>Paragraph one</p>
		<p>Paragraph <span style="border:5px solid blue;">two</span></p>
		<p>Paragraph three</p>
	</body>
</html>

Save & refresh browser:

My first Heading

Paragraph one

Paragraph two

Paragraph three

Leave a Reply