Span tag and div tag in Html
<span> tag
This tag is used for grouping and applying styles to inline elements.
<div> tag
This tag is nothing more than a container unit that encapsulates other page elements and divides the HTML documents into sections.
<div> is used to group together HTML elements and apply CSS styles to many elements at once.
Difference between <div> and <span> tag
The <span> tag is used with inline elements while the <div> tag is used with block-level content.
Example:
<!DOCTYPE html>
<html>
<head>
<title>Span and Div tag</title>
</head>
<body>
<!--With span tag-->
<span>Testing span 1</span>
<span>Testing span 2</span>
<span>Testing span 3</span>
<!--With div tag-->
<div>Testing div 1</div>
<div>Testing div 2</div>
<div>Testing div 3</div>
</body>
</html>
Output of this code will look like this:
