what is DIV

liunx

Guest
what is a DIV tag.what is it used for and when do we have to use it?<br />
<br />
thank you<!--content-->A <DIV> tag is a logical "division" of the page with special properties. By itself, it is nothing. However, it's the styles that you apply to them that make them very useful.<br />
<br />
For example, you could set a divison so that all text within it is a certain font, font-size, or font-color using cascading style-sheets.<br />
<br />
You use it when you wish to set special properties to objects on your page. It can also be used to replace alignment tags. The old <center> tag for example, is deprecated, and was replaced by <div align=center>, but I still use old <center> ;)<!--content-->but when i try to use it in a table.it doesnt work.<br />
if i want a div tag to be applied for a specific column in a table , it doesnt work.<br />
thank you<!--content-->what do u mean by z-index that is specified in DIV tag<!--content-->DIV tags can be positioned anywhere on the page with coordinates - they are not limited to follow the logical layout of the page.<br />
<br />
Because of this, DIV regions can overlap - the z-index defines the order in which the layers are displayed...<!--content-->Originally posted by srimca <br />
but when i try to use it in a table.it doesnt work.<br />
if i want a div tag to be applied for a specific column in a table , it doesnt work.<br />
thank you <br />
<br />
You can't do that. A table is a multi-tag construct in itself. You can't place anything between </tr> and <tr>. Everything except the tags that constitutes the table has to go in the cells, in the TDs. <br />
<br />
If you tell us what you want to accomplish maybe we can come up with a solution. :)<br />
Umm, where does z-index come into this?<!--content-->Just to clarify a little, z-index means the order which a division would be displayed in regard to bringing it forwards or sending it backwards. Like say, if I had an image with a z-index of 0, and another image with a z-index of 1, and they were placed on top of each other, the image with a z-index of 1 would appear to "overlap" the one with lower z-index.<!--content-->To clirify a little more, HTML has some very strict rules about how you can nest elements. MSIE is very good at figuring out what you intend when you break those rules but other browsers do not do so well. Thus, if you want your page to work on all browsers then you have to follow the rules found at <!-- m --><a class="postlink" href="http://www.w3.org/TR/html4/">http://www.w3.org/TR/html4/</a><!-- m -->. And you can check your pages, and you ought to check you pages, at <!-- m --><a class="postlink" href="http://validator.w3.org/">http://validator.w3.org/</a><!-- m -->. But you will need to have put the following at the very start of each page:<br />
<br />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><!--content-->Your signature is irritatingly large, don't you think?<!--content-->Yes, I quite agree. The trouble is that I've not come up with a cleaver substitute.<!--content-->You need a witty and relevant one-liner. I know mine's not that, but at least it's short!<!--content-->About z-index, it's not a feature of DIV. Any positioned element can be given a z-index and all elements can be positioned.<br />
<br />
Which leads to a warning about DIV and SPAN. We are getting a DIV-and-SPAN soup. Use them for grouping and when there is no other element for the job, not when there is. Turn style sheets off and see how a page built of DIVs and SPANs and nothing else looks. Not a nice sight.<!--content-->:) No, DIV is great for grouping things. Replacing P and H1 and BLOCKQUOTE with DIV is not great. If I say that you shouldn't put all text in H2s just because you like big and bold does that mean I hate H2?<br />
<br />
If you think you need DIV for everything you've missed the point of CSS. The point is - you can get any element to look exactly like you want in a modern graphical browser while they work as they should in everything else too provided you use structured markup.<br />
<br />
I couldn't create a DHTML menu because I know very little JavaScript. I might use a DIV as a container for the whole thing or I might not. I might use a UL or maybe P.<!--content-->WTF? Why do you post and then delete your posts Geat? That explains why srimca asked what someone meant by z-index when no one seemed to have mentioned it. :eek:<!--content-->Uh-deh-deh, hold your horses.<br />
<br />
I deleted the javascripty message cos I thought it was irrelevant, and the tone sounded a bit *****y which I didn't intend it to be.<br />
<br />
As for the z-index question, srimca put that there before I even looked at this thread. I think they're not an English-speaker, hence by:<br />
<br />
"what do u mean by z-index that is specified in DIV tag"<br />
<br />
I think they meant<br />
<br />
"what is meant by z-index"...<br />
<br />
So don't have a go at me!<!--content-->No, right. Not your fault this thread is all confused. :rolleyes:<!--content-->That hurts, it really does. Sarcasm is the lowest form of wit you know...<!--content-->i dont know why there is so much confusion abt this thread.<br />
i just asked <br />
what is DIV and what is the use of z-index which we specify in the div tag and i feel that nicodemas clarified it to an extent.<br />
but i want to know whether z-index is a part of div tag syntax or not??<!--content-->No, it isn't.. z-index is CSS. It denoted the stacking order of positioned elements.<!--content-->iam not yet clear about the z-index part.<br />
pls make it clear with examples.<br />
thank you meow.<!--content-->Ok. With CSS you can position elements so they overlap. Normally an element that comes later in the code gets on top of one that comes earlier. I've done so here (<!-- m --><a class="postlink" href="http://w1.181.telia.com/~u18109800/no_zindex.html">http://w1.181.telia.com/~u18109800/no_zindex.html</a><!-- m -->). The red paragraph is on top of the black header because it comes later in the HTML:<br />
<br />
<h1>My little page</h1><br />
<p><br />
This page is about me</p><br />
<br />
Here (<!-- m --><a class="postlink" href="http://w1.181.telia.com/~u18109800/zindex.html">http://w1.181.telia.com/~u18109800/zindex.html</a><!-- m -->) I change that with z-index. A positioned element with a higher z-index will be on top of one with a lower z-index.<br />
<br />
<!-- m --><a class="postlink" href="http://www.w3.org/TR/REC-CSS2/visuren.html#propdef-z-index">http://www.w3.org/TR/REC-CSS2/visuren.h ... ef-z-index</a><!-- m --><!--content-->thanks meow.<br />
that was wonderful.<br />
i now understand the purpose of z-index.<br />
thanks<!--content-->
 
Back
Top