IE7 css padding problem?

here is my problem. i added padding to my div and reduced the div height accordingly. all browsers except IE7 will render it properly (no surprise...). I have tried a conditional comment to add more padding but it doesnt help one bit.




padding: 15px 20px 0px 42px;







I have tested it on Safari, Firefox 3, Opera, IE8 Beta and IE7 - all but the latter work ok. I have had this problem before but i am stumped as to how to fix it. Adding more padding does not help.


adam, tried that with padding-top: instead of height and it does nothing sadly. is there anything else microsoft require to get padding to work?

Update 2:

hi littlegraywolf - the height of the div physically is 323px and ive already reduced it by the 15 pixels, hence why its 308. ive fixed this before which is why it is so frustrating! i think ill give that method a try soon, im losing my patience with microsofts buggy browsers.

Update 3:

excellent answers all round guys, adam - yours worked a treat in the end after i implemented it correctly. and littlegraywolf - its a tip ive learned and i can use in the future.

much appreciated folks thank you!

6 Answers

  • Anonymous
    1 decade ago
    Favorite Answer

    Here's a solution:

    height: 25px; //Firefox, Most browsers

    !height: 16px; //IE7

    _height: 20px; //IE6

    The last 2 comments only work in IE.

    With these ! or _ declarations, you can change the height, width, padding, any CSS for IE7 and IE6, and it won't affect Firefox/most browsers.

    --This solution won't validate. You can create a second stylesheet and put all of your IE declarations in it if you want your normal stylesheet to validate.

    Source(s): If this doesn't work, go with the other guy's idea.
    • Log in to reply to the answers
  • 1 decade ago

    I hate this kind of issues myself. Seen a number of them.

    I found that the conflict for IE comes up when you declare static height/with AND pad the box.

    What IE does is add padding to your box, i.e.

    Height: 438 + top padding 15 becomes 453 (is my math is correct). Which creates a problem.

    I found that the best solution is to have another container inside the static height/width one what is flexible height/with and has the padding parameters.

    So you would have:

    <div id="YourOldContainer">

    <!-- this will have your css MINUS the padding -->

    <div id="NewBufferContainer" style="padding: 15px 20px 0px 42px;">

    All your actual content goes here.




    • Log in to reply to the answers
  • 4 years ago

    Start wining income with the Zcodes System from here .

    Zcodes System is an easy yet strong system. No further guesswork or counting purely on a really fickle woman Luck. You get just what you need and are found exactly that which you have to do in order to win regularly

    In the event that you use Zcodes System you are supplied with detailed video lessons and lessons to show you just how the device operates and things you need to complete in order to make money.

    Zcodes System is great for newbies to because even although you know absolutely nothing about activities once you join, you will learn whatever you have to know rapidly and effectively and you will specially discover ways to maximize your spending to reap the best winning rewards.

    • Log in to reply to the answers
  • 4 years ago

    If you want to learn ways to leverage it to maximize your activities betting winnings then this system is for you because Zcodes System is about this.

    Zcodes System is the title of a activities betting system that's existed, in a few variety or yet another, because 1999. Zcodes System is an advanced statistically based process that's cracked the “code” of how sports games may enjoy out.

    Zcodes System is your absolute best friend in sport betting.

    • Log in to reply to the answers
  • What do you think of the answers? You can sign in to give your opinion on the answer.
  • 1 decade ago

    Bloody Microsoft and it stupid browser eh!

    I can't see anything wrong with it really, perhaps you better look in Microsoft's re-written guide originally created by the W3 but Microsoft decided to be idiots and make developers lives hell.

    • Log in to reply to the answers
  • Diana
    Lv 4
    4 years ago

    In short, no. This is part of the job of a web developer. We don't have handy programs to do everything for us. Sometimes, you have to do things manually.

    • Log in to reply to the answers
Still have questions? Get answers by asking now.