HTML Div

Html – Div element

The Tag is nothing more than a container for other tags. Much like the body tag, Div elements are block elements and work behind the scenes grouping other tags together. Use only the following attributes with your div element, anything else should be reserved for CSS.
• id
• width
• height
• title
• style

For the purpose of this example, we have included the style attribute in order to color our div tag in order to bring a stronger visualization for our viewers.
HTML Code:

<div style=”background: green;”>
<h5>SEARCH LINKS</h5>
<a href=”http://www.google.com” target=”_blank”>Google</a>
</div>

OUTPUT:

SEARCH LINKS

Google

Above is a great visual about how a div plays the role of a container for other HTML elements, applying a background color/image is the only real way to visualize your div tags.

Html – Div Layouts

When HTML first began, web creators only had two choices. A table layout, orframes. The div element provides a 3rd alternative, since a div can contain any/every other type of html element within its beginning and ending tag.
HTML Code:

<div id=”menu”><a>HOME</a> |
<a>CONTACT</a> |
<a>ABOUT</a></div>
<div id=”content”>
<h5>Content Articles</h5>
This paragraph would be your content paragraph with all of your readable material.
</div>

OUTPUT:

Content Articles

This paragraph would be your content paragraph with all of your readable material.

Advanced web developers find div elements to be far easier to work with than tables, adding more content or more links to our previous example might demonstrates why a div is simpler to work with. Let’s add a “LINKS” page to our menu, and another article of content below the existing content.

HTML Div Layout II

HTML Code:

<div align=”right” >
<a href=””>HOME</a> |
<a href=””>CONTACT</a> |
<a href=””>ABOUT</a> |
<a href=””>LINKS</a>
</div>

<div align=”left” >
<h5>Content Articles</h5>
<p>This paragraph would be your content
paragraph with all of your readable material.</p>
<h5 >Content Article Number Two</h5>
<p>Here’s another content article right here.</p>
</div>

OUTPUT:

Content Articles

This paragraph would be your content paragraph with all of your readable material.

Content Article Number Two

Here’s another content article right here.

DOWNLOAD SOLUTION HERE