DIV html tag and its main advantage

Spread the love

The DIV tag is used mainly for laying of web page and to apply alignment and style to a particular section of a document. We normally use tables to align pages. We use div tags to take control of total page layout easily. Div tag is very easy to understand if you follow me in this lesson.

The basic syntax of div tag is:

<DIV> </DIV>

I will explain this div tag with an example. Type below code in a notepad and save as .html and open it using any browser software. You will get two boxes opposite side and left some place in between boxes. So you can place different sized sections in single page without using table. You can control total page by using simple div tags. If you use css with div tags, you can beautifully layout pages.

<html>
<head>
<title>Learning about DIV tag – Laying out a web page without using table </title>
</head>

<body>

<div style=”border: thin solid 000000; width:45%; float: left”>
This div is placed left
</div>

<div style=”border: thin solid 000000; width:45%; float: right”>
This div is placed right
</div>

</body>
</html>

I have used float in both the div tags to place one to left and another to right. You can change the back ground colour of both DIVs with different colours, different sizes, different font, different height using style attribute. Managing DIVs are very easy with cascading style sheets. We discuss about style sheets in further lessons.

You can ask me any type of question about div tags by sending a message. You may get little confusion to understand div concept. You will enjoy laying pages after getting idea of using div tags.

(Visited 236 times, 1 visits today)

4 Comments

  1. Automotive

    It’s hard to come by knowledgeable people on this subject,
    but you sound like you know what you’re talking about!
    Thanks

    Reply
  2. automobile insurance quote

    Everyone loves what you guys are up too. This type of clever work and exposure!
    Keep up the excellent works guys I’ve incorporated you guys to our blogroll.

    Reply
  3. captcha bypass code

    Hey There. I found your weblog the usage of msn.
    That is a really smartly written article.
    I’ll be sure to bookmark it and return to read more of your helpful info. Thank you for the post. I will certainly return.

    Reply

Leave a Reply

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