View Full Version : <div>
Aragoth
10-10-2006, 04:17 PM
Now, seriously, I really would love to know what in God's name this tag accomplishes. I see it in almost every source code, but I have no clue what it actually does. Can somebody clue me in?
mwinter
10-10-2006, 07:22 PM
The div element is a generic block-level element. It's main use is to group elements together (headers [but not headings], footers, etc.), particularly to allow that group to manipulated as one in a style sheet. It can also be used if there are no appropriate, semantic block-level elements that can be used to mark up part of a document. The span element is similar, though it is an in-line element.
For example, to mark up an address[1], one might write:
<div class="address">
...
</div>
To mark up the name of a species,
<span class="species">H. s. sapiens</span>
would be appropriate, though so would use of the i element (maintaining the italic presentation might be more important than avoiding presentational markup in the event of no CSS).
Mike
[1] There is an address element, but that is for information about the author of the document, not addresses in general.
the-disturbed
10-16-2006, 11:08 PM
gouping works i guess, but the tag won't do anything usefull unless you define the parameters, for example piczo, uses div tags to group chunks of html together, each image is placed in a div tag, as well as the friends and page lists, allowing you to drag everything around and not worry about p and br tags, you can also use div tags to create moveable elements merzo.net (http://www.merzo.net) (lame webpage but perfect example of moveable divs
DIV like others said, groups certain parts of the code. If you have a stylesheet, then you can apply certain styles to only the parts with that name. It also helps for javascript and other things
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.