<div> Tag: The HTML <div> tag is used for defining a Division or Section of the web page.with the help of div tag we can group large sections of HTML elements together and format them with CSS.
Syntax:
:
:
<head>
<style>
div {display:block;}
div1{display:block;}
:
:
</style>
</head>
:
Above definition of div tag, define using in internal style sheet.
For Example: divide the web page in three section using div tag in css definition.
<html>
<head>
<title> Div tag definition </title>
<style>
div {
display: block;color:red;width:100%;height:200px;background-color:green;
}
div1 {
display: block;color:red;width:100%;height:200px;background-color:blue;}
div2 {
display: block;color:white;width:100%;height:200px;background-color:red;}
</style>
</head>
<body>
<div>this is a first section of web page using div tag.</div>
<div1>this is a second section of web page using div tag.</div1>
<div2>this is a third section of web page using div tag.</div2>
</body>
</html>
The Browser view of above web page:
Syntax:
:
:
<head>
<style>
div {display:block;}
div1{display:block;}
:
:
</style>
</head>
:
Above definition of div tag, define using in internal style sheet.
For Example: divide the web page in three section using div tag in css definition.
<html>
<head>
<title> Div tag definition </title>
<style>
div {
display: block;color:red;width:100%;height:200px;background-color:green;
}
div1 {
display: block;color:red;width:100%;height:200px;background-color:blue;}
div2 {
display: block;color:white;width:100%;height:200px;background-color:red;}
</style>
</head>
<body>
<div>this is a first section of web page using div tag.</div>
<div1>this is a second section of web page using div tag.</div1>
<div2>this is a third section of web page using div tag.</div2>
</body>
</html>
The Browser view of above web page:
In this Web Page we divide web page in three section first section have have background green, second section have background blue and third section is red.
No comments:
Post a Comment