Div Tags - WHAT!

Out of context: Reply #12

  • Started
  • Last post
  • 19 Responses
  • BattleAxe0

    ah yes, yes they are nightmares when you first DIVe into them,

    but really the div tag is not the problem it is the styles that you apply to them that make or break them.

    here is a little tid bit that I learned via trail and error

    say you have a DIV tag with a property width of 200 px , if you you add margins or padding to the DIV it will add to the over all size of your div , so a width of 200px with padding on the left and right of say 10px each, the div is now 220px wide, but your css property will still say 200 px.

    this is what kept me boggled for a while because things would shit, so if you need the area to be exactly 200 px , you do 180px width to compensate for the 10px padding that you are adding on both sides

    same for heights

    have fun

    • same with %'sBattleAxe
    • *shiftBattleAxe
    • don't forget IE calculates the box model differently.canuck
    • IE6
      ********
    • < yes.canuck
    • It's often easier to nest divs. Give the outer a width and apply padding margins, whatever, to the inner.welded

View thread