...

View Full Version : explain div



cuchandoo
08-02-2007, 09:54 AM
I am a php programmer,working with ajax applications,in it for the display they used div
shall iknow how to use div?
can anybody send the code to store a image in div.and the magics of div?:confused:

Jutlander
08-02-2007, 10:22 AM
Well, a div is a block level element so you can pretty much place anything inside it and yes it's a very useful tag to know. Remember that it doesn't do anything on its own, but must have a class or an ID assigned to it. You then style the class or ID with CSS.

One way to "store" your image in the div would be to give it a background image.


#IDname {
background: url(image.gif);
height: 100px;
width: 150px;
}

You would then call it with:


<div id="IDname"></div>

cuchandoo
08-02-2007, 10:35 AM
Thank u
if i want to write any thing in the div,i have to use
document.getElementById().innerhtml.[for the text]
and for the
image what i have to do?
The problem of mine was i have to show the image,from the server in the div tag
then i got the prob
can u refer any url for me ,or any advise.
Thanks for sparing u r time for me,:)

Jutlander
08-02-2007, 10:41 AM
You may place what you like in a div:


<div id="IDname">

<h1>My first heading</h1>

<p>A paragraph</p>

<img src="path_to_image.gif" alt="This is an image">

</div>

This will all be put over the background image. You might want to look into this: http://www.w3.org/TR/html4/struct/global.html#h-7.5.4

cuchandoo
08-03-2007, 07:16 AM
thank u jutlander ,Take care

felgall
08-03-2007, 07:49 AM
DIV is short for division or divider and its intended use is to divide up the content of the page into separate sections.

The main uses are

1. with an id to break the page up into sections eg.
<div id="header"></div>
<div id="navigation"></div>
<div id="content"></div>
<div id="footer"></div>

2. with a class to use as block level tags which do not have a semantically valid block level tag already defined for them. You would then use a descriptive class name to define what the tag would be that you would be using if such a tag existed.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum