The HTML <div>…..</div> tag is used define a section of document. Using div tag, you can group large sections of HTML elements together and format them with CSS. The <div> element is very often used together with CSS, to layout a web page.
By default, browsers always place a line break before and after the <div> element. However, this can be changed with CSS.
Inside: Body tag
<html>
<head> </head>
<body>
<p>paragraph outside div tag</p>
<div style="color: red">
<h3>heading tag is inside div tag</h3>
<p>paragraph tag is inside div tag</p>
</div>
</body>
</html>
Outside: Body tag
<html>
<head>
<style>
div {
color: red;
}
</style>
</head>
<body>
This is body.
<div> inside div tag which is calling form the out side of the body</div>
</body>
</html>
Latest posts by vikashdev k (see all)
- PHP OOP: Traits - October 25, 2021
- PHP OOP: Late Static Binding - October 25, 2021
- PHP OOP : Static Members - October 23, 2021