<div> vs <p>

Discussion in 'CSS' started by safe_reader, Aug 3, 2006.

  1. #1
    I've noticed in a lot of my css, when ever I have <div class=... there is no difference from using <p class=...

    So... does it really make no difference, or am I missing something?
     
    safe_reader, Aug 3, 2006 IP
  2. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #2
    A div element is an aggregating element. Its purpose is to group other elements and establish a style context.

    A p, or paragraph element is for limning a bit of text as being a, um, paragraph.

    So why use one instead of the other? For the same reason you call one vehicle a sedan and another a firetruck; because that's what they are. If you describe things correctly (semantically), you can use the description to parse the document or to use DOMscripting to add behaviors to specific element types. Or you can just do it for the pride you take in doing things correctly.

    cheers,

    gary
     
    kk5st, Aug 3, 2006 IP