Welcome to Our Free Tutorial!

Basic HTML DIV

HTML - DIV Codes

The <div> tag is container for the other tags. It is like body tag. You can use controls within <div> tag. You can use the following attributes with div tag we have include the style attribute.

1. Id
2. width
3. height
4. title
5. style

HTML Code:

<body>
<div style="background: red">
<h5>SEARCH LINKS </h5>
<a target="_blank" href="http://www.google.com">Google </a>
</div>
</body>

Result:

SEARCH LINKS

Google

HTML- Div Layout

HTML Code:

<div id="menu" align="right">
<a href="">HOME </a> |
<a href="">CONTACT US </a> | 
<a href="">ABOUT US </a>
<a href="">SITE MAP </a>
</div>
<div id="content" align="left" bgcolor="white">
<h5>Write Articles </h5>
<p> Stress is the “Wear and tear” our 
bodies experience 
as we adjust to our continually 
changingenvironment, is has
 physical and emotional effects on us and 
can create positive or negative feelings.
      </p>
</div>
      

Output:

Write Articles

Stress is the “Wear and tear” our bodies experience as we adjust to our continually changing environment, is has physical and emotional effects on us and can create positive or negative feelings.


HTML Code:

<div id="menu" style=" text-align:right;" >
<a href="">HOME </a> |
<a href="">CONTACT US </a> | 
<a href="">ABOUT US </a>
<a href="">SITE MAP </a>
</div>
<div id="content" align="left" bgcolor="white">
<h5>Write Articles </h5>
<p> Stress is the “Wear and tear” our bodies experience 
as we adjust to our continually changingenvironment, is has 
physical and emotional effects on us and can create positive
 or negative feelings.
</p>
</div>

Output:

Write Articles

Stress is the “Wear and tear” our bodies experience as we adjust to our continually changing environment, is has physical and emotional effects on us and can create positive or negative feelings.


HTML Code:

<div id="menu" style=" text-align:center;" >
<a href="">HOME </a> |
<a href="">CONTACT US </a> | 
<a href="">ABOUT US </a>
<a href="">SITE MAP </a>
</div>
<div id="content" align="left" bgcolor="white">
<h5>Write Articles </h5>
<p> Stress is the “Wear and tear” our bodies experience as 
we adjust to our continually changing
environment, is has physical and emotional effects on us and 
can create positive or negative feelings.
</p>
</div>

Output:

Write Articles

Stress is the “Wear and tear” our bodies experience as we adjust to our continually changing environment, is has physical and emotional effects on us and can create positive or negative feelings.