SQL PHP HTML JavaScript articles and free code
 

Integrating id align class to Div Tag

We can divide different areas of web page using div tags. This is a powerful tool and for different applications which we will discuss later. Here we will try to understand the basics of div tag.

Using div tag we can control a particular area or a block of code and text within it. Div tag ads one line break before it staring and after it ending tag. Here is a simple structure of div tag.

<div id="my_area">
My text here
</div>

You can see we have defined the are within the div tag with id=my_area , this is useful for us to further manage the area using DHTML. We will learn them in our next tutorial. Now we will learn different attributes with examples.

Attributes Align: Values : left, right, center, justify
We can set the align attribute to different values and manage the text within the div tag area. Here is one example of align attribute

<div id="my_area" align="right">
My text here
</div>
My text here
<div id="my_area" align="center">
My text here
</div>
My text here
<div id="my_area" align="left">
My text here
</div>
My text here
We can integrate our existing style sheet and define a class for the div tag. Here is the code to integrate an existing class to the div tag

<div id="my_area" class="data">
This is a right aligned text2
</div>

Now let us try to add one title to this div tag. On mouse over the div area title text will be displayed like alt tag of images. Here is the code

<div id="my_area" class="data" title="This is a test for title on Div tag">
This is a right aligned text2
</div>

To see the example place your mouse over this line

This is the basic of div tag, we will try to learn more on application of div tag in DHTML by placing mouse over it.

How to position a div tag

Discuss this tutorial at forum

List of HTML Tutorials

 

Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.

Scripts
PHP
JavaScript
List of HTML Tutorial
HTML Tags
Color Chart
HTML Calendar
Tags on web page
Web Design
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.