1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Too much DIV ?

Discussion in 'HTML & Website Design' started by buywiser, Mar 23, 2011.

  1. #1
    Read that we shouldn't be using too much DIV's(+ SPAN, CLASS, ID's), but when comparing my code with others: remarked that most of them are abusing-it way more.

    What is too much?

    Thanks in advance!
     
    buywiser, Mar 23, 2011 IP
  2. xira

    xira Active Member

    Messages:
    315
    Likes Received:
    8
    Best Answers:
    4
    Trophy Points:
    68
    #2
    The usage of DIVs is preferred to using TABLE tags, as of XHTML and HTML4. However, with HTML5 and support for CSS3 (coming soon in IE9, currently in FF4 and partially supported by Chrome) you can reduce the amount of DIVs by using CSS3 display features. In short, instead of creating a whole table hierarchy, you simply write .myclass{display: table-cell;} The browsers know to fill in the rest of the information (table, body, row, etc.) which reduces the number of DIVs you need significantly.
    Ironically after killing ourselves to learn to code without tables, we will be going back to them... but using CSS instead of HTML. This will reduce the amount of DIVs and code overall. :)
     
    xira, Mar 24, 2011 IP
    buywiser likes this.
  3. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Enclosing elements in divs that are fine on their own. That's annoying because it takes me longer to see the page structure.
     
    Cash Nebula, Mar 24, 2011 IP
    buywiser likes this.
  4. subdivisions

    subdivisions Well-Known Member

    Messages:
    1,021
    Likes Received:
    40
    Best Answers:
    1
    Trophy Points:
    145
    #4
    You can use as many divs as you want, but using less will make your code a little easier to read.
     
    subdivisions, Mar 24, 2011 IP
    buywiser likes this.
  5. buywiser

    buywiser Peon

    Messages:
    459
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks for your tips!
    Going back to work on gedit & having a clear view. :)
     
    buywiser, Mar 25, 2011 IP