SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Basic div padding question

    I've seen this code before, but never really paid much attention to it. I was browsing around and found a site that i liked, took a peek at the code and found the following declaration for padding. Can someone help me understand why you would declare a padding setting at a certain pixel amount, then declare it as 0 right after it?

    the code in question:
    Code:
    #content {
    padding-bottom:26px !important;
    	padding-bottom:0;
    	text-align:justify;
    }
    Thanks for any pointers!
    Pedro

  2. #2
    SitePoint Evangelist croatiankid's Avatar
    Join Date
    Mar 2007
    Location
    Zagreb, Croatia
    Posts
    409
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    because browsers that don't support !important (IE 6, maybe 7) will ignore the former.
    Hrvoje Markovic
    Croatiankid designs

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    croatiankid,

    So, if IE 6 (and maybe 7) ignore the !important part, and assuming that you did want a 26px paddding at the bottom of the div, why would you then declare the padding to be ZERO? That's the part that's confusing me....

    Thanks for your fast response!
    Pedro

  4. #4
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,367
    Mentioned
    180 Post(s)
    Tagged
    6 Thread(s)
    Yes as said above its just a hack to target ie6 and under. IE7 understands !important and will not be fooled by it though.

    The code you show above gives 26px padding bottom to ie6 and under but all other browsers will get padding:0. Either the author is trying to overcome a real bug in ie6 (of which there are many) but more likely they have miscalculated something somewhere else.

  5. #5
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Paul,

    Thanks for the clarification! What? IE6 has some bugs?

    Have a great day,
    Pedro

  6. #6
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    All browsers have bugs (even Opera). Some just have far more than others. One in particular has been the bane of Web designers for the better part of a decade.


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
  •