Results 1 to 4 of 4

Thread: <div>

  1. #1
    Join Date
    Dec 2005
    Location
    Canada
    Posts
    82
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default <div>

    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?

  2. #2
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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:

    HTML Code:
    <div class="address">
    ...
    </div>
    To mark up the name of a species,

    HTML Code:
    <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.

  3. #3
    Join Date
    Oct 2006
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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 (lame webpage but perfect example of moveable divs

  4. #4
    Join Date
    Oct 2006
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •