Horje
HTML <div> Tag

A <div> tag is used to maintain CSS Style in the most cases.

The <div> tag defines a division or a section in an HTML document.

The <div> tag is used as a container for HTML elements - which is then styled with CSS or manipulated with JavaScript.

The <div> tag is easily styled by using the class or id attribute.

Any sort of content can be put inside the <div> tag! 

Note: By default, browsers always place a line break before and after the <div> element.


How to create HTML <div> Tag

A <div> section in a document that is styled with CSS
index.html
Example: HTML
 <html>
<head>
<style>
.myDiv {
  border: 5px outset red;
  background-color: lightblue;
  text-align: center;
}
</style>
</head>
<body>

<div class="myDiv">
  <h2>This is a heading in a div element</h2>
  <p>This is some text in a div element.</p>
</div>

</body>
</html> 

Output should be:

How to create HTML <div> Tag

What Type of Browsers will Support for HTML <div> Tag

What Type of Browsers will Support for HTML <div> Tag

How to set Default CSS Settings for HTML <div> Tag

Most browsers will display the <div> element with the following default values.
index.html
Example: HTML
<style>
div { 
  display: block;
}
</style>

Output should be:

How to set Default CSS Settings for HTML <div> Tag





Category:
Web Tutorial
Sub Category:
HTML Tag
Uploaded by:
Admin


Read Article
https://develop.horje.com/learn/1434/reference