HomeWeb DesignHTMLHtml div Tag in HTML: its Uses

Html div Tag in HTML: its Uses

Html div Tag in HTML: its Uses

<div> tag behaves like a container for HTML elements and it can be styled with CSS. here, we can use number of Html elements together. you can divide Html elements such as <p>, <h1>, <h4>, <iframe> and <img> from others elements with the help of <div> tag.

Syntax: <div> ———- </div>

in most cases, programmers use <div> ——– </div>tags for separating complete pages into sections like header, footer, left, right section in a web page.

Example

<html>
<body>
<div style="background:red">
  <h1> Welcome to PrepareExams.Com </h1>
  <p>Learn how to use a div element in a web page.</p>
</div>

<div style="background:blue">
  <h1> Welcome to PrepareExams.Com </h1>
  <p>Learn how to use a div element in a web page.</p>
</div>

<div style="background:pink">
  <h1> Welcome to PrepareExams.Com </h1>
  <p>Learn how to use a div element in a web page.</p>
</div>
</body>
</html>

OUTPUT

div Tag in HTML
Html div Tag in HTML: its Uses 2

- Advertisment -

Latest Articles