Span and div tags
6- Span and div tag
----- Description-----6- Span and div tag
Div tag
This tag is nothing more than a container unit that encapsulates other page elements and divides the HTML document into sections.
Web developers use <div> elements to group together HTML elements and apply CSS styles to many elements at once.
Span tag
This tag is used for grouping and applying styles to inline elements.
This tag is similar to <div> tag, to see difference between the two, check the next example.
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-input
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>div tag</title>
</head>
<body>
<span> tag
<span>Testing 1</span>
<span>Testing 2</span>
<span>Testing 3</span>
<div> tag
Comments
Post a Comment