HTML: div tag

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>

Tagged : / / / / / / /