<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>div tag</title>
</head>
<body>
<!--Div can be used to group elements-->
<div>
This is the First Div
<input type="text">
<input type="text">
<input type="text">
</div>
<div>
This is the Second Div
<input type="text">
<button>Sample Button</button>
</div>
</body>
</html>. Definition:-
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.
Testing 3 Output:-This is the First Div
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>div tag</title>
</head>
<body>
<!--Div can be used to group elements-->
<div>
This is the First Div
<input type="text">
<input type="text">
<input type="text">
</div>
<div>
This is the Second Div
<input type="text">
<button>Sample Button</button>
</div>
</body>
</html>. Definition:-
<div> tag
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
<span> tag
<span>Testing 1</span>
<span>Testing 2</span>
<span>Testing 3</span>
Output
Testing 1 Testing 2 Testing 3
<div> tag
<div>Testing 1</div>
<div>Testing 2</div>
<div>Testing 3</div>
Output
Testing 1
Testing 2
This is the Second Div
HTML:-Div tag
Reviewed by Network security
on
April 29, 2019
Rating:
No comments: