on air

DIV And Table Elements.

back home » webtutorials » HTML » DIV And Table Elements.


Learn how to use the HTML DIV and Table Elements. Both result out somehow the same span, still each has its special way of implementation. However, the decision will always be yours to make, which one to choose and when to use.

DIV Element.

DIV tag is nothing than a container that can contain HTML elements, allowing its contents get formatted in a form of a group using CSS.

It's easy and quicker to define sections like block elements in HTML document using DIV and CSS.

DIV supports some Standard and Event Attributes. DIV also uses opening and closing tags like any other HTML Element that needs a closing tag in its form.

Illustration below is a basic DIV syntax.


A DIV element is formatted with CSS, using either the HTML class or id attributes.

See illustration below.

<div class="SpecifiedCSS">Content</div>

<div id="SpecifiedCSS">Content</div>

I personally like to use CSS in my documents, so I'm also using lots of DIVs, which make things much easier and accurate for me.

Table Element

HTML table consists of four main elements. Each element uses an opening and closing tags as usual, and they lists up as follows <table> <tr> <th> and <td>.

Below is an HTML table Structure with two TH cells and two TD cells wrapped by a TABLE tag with a border attribute that has one pixel value.

Copy this and paste it into your HTML editor (NOTOPAD), save it with any name without space but .html or .htm and preview it in a browser of your choice to see how it will look like.

Copy or re-write code below.

<table border="1">
<td>Row 1-Cell1</td><td>Row1-Cell2</td>

Now we've been talking about opening and closing tags so many times so I'm sure you understand how HTML elements are being used at this point.

Let me explain once more how the HTML TABLE elements works.

The <table> tag is the container that surrounds a table, and the <tr> tag is the ROW in a table that goes Horizontal, from left to right.

The <td> tag is the Dimension in a table that goes Vertically, from up to down through the ROWS to create CELLS and its called the table data.

This is by default align to the left, which means whatever you drop inside, being it, a text or an image will float to the left.

Unless it's been defined with the attribute, align or valign to either the right, center, or justify for the Horizontal line like for example, <td align="right">.

And or to the top, middle or bottom for the vertical line like this: <td valign="top">.

These two Attributes can be use for TR, TH, and TD tags and also in combination.

The <th> tag defines a header in a table. It's by default formatted bold and centered.

See the result in the code below.

You can use the colspan Attribute to let the content span itself over multiple columns.

Watch the <th colspan="4">Header</th> below.

You can apply the same method to span a row with the rowspan Attribute.

See illustration below.
<table border="1">
<th colspan="4">Heder</th>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
<td>row 1, cell 3</td>
<td>row 1, cell 4</td>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
<td>row 2, cell 3</td>
<td>row 2, cell 4</td>

Below is how the above used colspan Attribute will look like, in your browser. You may retype the above code into your editor, preview it in your choice of a browser and see how it works.

colspan browser look

Tables vs. DIVs Video Tutorial.


Man will give you worldly powers, and make you feel on top of all, note this is temporally and could be redrawn at anytime sending you back to the ground floor of life. However, the Lord Almighty, the one and the only rightful ruler of the Universe, blesses everlastingly.


Knowledge is Power, but Power is not Knowledge. Wisdom is the truthful Power that identifies the Knowledge within the man. And only, I repeat 3x. Only the almighty God has the power to bless the man with his Wisdom forever.

To achieve the Lord's blessings, cease not praying daily, asking for his Wisdom, and you'll be blessed abundantly...


Spyera Phone

Spyera Phone version is software that you install on a smart phone to monitor everything happening on the phone. After installation, SPYERA secretly records events (sms, call history, phone book, location, emails, What's App messages, IM, Facebook Chat, Skype, See photos taken and many more...) that happen on the phone and delivers these information to a web account, where you can view these reports 24/7 from any Internet enabled computer or mobile phone. SPYERA also allows you to listen to the surroundings of the target mobile , listen to the phone conversation and to know the location of the device.

Please, Kindly Donate What You Can, Enabling Us Pay Hosting And Domain Costing, And Do More.

Please Donate