ITSourceCode.com

We Exist to Provide 100% Free Source Code and Tutorials

Custom Search

35-HTML Div

The <div> tag is a container unit that stores other page elements and divides the HTML document into parts. Webmasters use <div> elements to put together HTML elements and apply CSS styles to all elements at once.

 

For instance, when you place a set of paragraph elements into a <div> element, you can use CSS styles and apply it to all paragraphs at once.

 

Example:

<div id="myContainer" name="myContainer" title="My Div Element">
 <h3>Subheader</h3>
 <p>This is the content of the paragraph...</p>
 <p>Here's another content of the paragraph.</p> 
</div>

 

Result:

Subheader

This is the content of the paragraph…

Here’s another content of the paragraph.

 

Another Example:

<div id="myContainer" name="myContainer" title="My Div Element" style="color: #0000FF; font: Arial 15pt;border: 2px solid brown;">
 <h2>Subheader</h2>
 <p>This is the content of the paragraph...</p>
 <p>Here's another content of the paragraph.</p> 
</div>

Result:

Subheader

This is the content of the paragraph…

Here’s another content of the paragraph.

Facebook Comments

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked *

ITSourceCode.com © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!