#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    33
    Rep Power
    12

    CSS: CLASS, ID, DIV, and SPAN Confusion


    I am having trouble understanding what exactly the CLASS, ID, DIV, and SPAN elements and attributes do.
    What are there purposes?
    How do the relate to each other?
    When should one be used and not another?

    In laymens terms please.

    Thanks
  2. #2
  3. Thanks Johnny Hart (BC) R.I.P.

    Join Date
    May 2003
    Location
    Dallas
    Posts
    5,268
    Rep Power
    1956
    Class contains rules that can apply to any element. Think of class as referring to any persons having a certain set of attributes.

    .scots { hair-color: red; eye-color: blue; }

    ID refers to a single, individual, unique element.

    #fergus { demeanor: grouchy; }

    No two elements can be named fergus, but any number may be of the class scots.

    div is a block element that acts as a container. Rules may be applied to a div by id or class. To make things a bit more confusing, a div may be defined as inline.

    span is an inline element that acts as a container. Rules may be applied to a div by id or class. To make things a bit more confusing, a span may be defined as block. HTH

    cheers,

    gary
    There are those who manage to build a web site without knowing what they're doing; thereby proving to themselves they do, indeed, know what they're doing.

    My html and css workshop, demos and tutorials.
    Ask a better question, get a better answer.

IMN logo majestic logo threadwatch logo seochat tools logo