Internet Explorer Submit Button Horizontal Padding

Bookmark and Share

As you already know Internet Explorer takes great care to interpret HTML and CSS in it’s own special way and only sometimes does this co-incide with the W3C’s specification. The padding on Submit Buttons is one such nuisance.

Simply, IE simply ingores any horizontal padding you specify with css. The solution, I discovered, it to use the “overflow: visible” for all such elements e.g.

Before

<input type="submit" value="Internet explorer ignores my padding" style="padding: 20px;" />


After:
<input type="submit" value="Internet explorer respects my padding" style="padding: 20px; overflow: visible;" />

NB For this example I’ve put the style inline with the html - for real use this should be separated from the html in an external style sheet.

22 Responses to “Internet Explorer Submit Button Horizontal Padding”


  1. 1 Vince Jun 27th, 2007 at 11:19 am

    Thank you for this solution.
    It works very well on IE 6 and 7

  2. 2 Rene Robinson Sep 20th, 2007 at 9:29 pm

    Thanks so much - I have been looking for this for AGES!
    Thanks again.

  3. 3 Amanda C. Apr 7th, 2008 at 4:02 pm

    Thank you so much for putting this out here. I have been looking for a solution to this problem for a current project at work. This works perfectly.

  4. 4 Lenny Oct 27th, 2008 at 8:15 pm

    Oh gee, who would’ve thought it’s as simple as that. Thanks alot for the hint :)

  5. 5 jeep Dec 14th, 2008 at 7:14 pm

    Wohoo big thanks, I have been loking a long time.

  6. 6 Ray Dec 16th, 2008 at 4:28 pm

    Thank you! I was just searching for this.

  7. 7 Eric Jan 19th, 2009 at 11:51 am

    Thank you. Very straight forward fix to another stupid IE bug!
    (:

  8. 8 Ivan Feb 1st, 2009 at 8:53 am

    Just used this. Works well. 1

  9. 9 Jones Mar 4th, 2009 at 10:39 am

    Thanks for that simple solution.
    But is there a way how this works with input[type='button'], too?

  10. 10 robert Mar 12th, 2009 at 1:43 pm

    overflow:visible can trigger sometimes a weird bug in ie7: when you scroll down the page, the button text disappears. Then it appears again, sometimes complete, sometimes as if it was half erased. Really annoying!
    I saw it in action several times. It happens when I set a background image for the input.

  11. 11 Simon Bruce Mar 23rd, 2009 at 12:39 pm

    This seems to be fixed in Internet Explorer 8.

  12. 12 Rollo Mar 24th, 2009 at 11:42 am

    Thanks for saving me hours of annoyance, much appreciated.

  13. 13 Alex May 29th, 2009 at 9:50 am

    @Robert : I had this weird “disappearing content” bug in IE7 too when setting the overflow:visible property on an input submit that has a background image. I changed the value to “auto” (overflow:auto;)and added a text-align:left and it got rid of this problem. Does this work for you ?

  14. 14 Bartezz Jun 8th, 2009 at 9:03 am

    Thanx!

  15. 15 Tina Jul 16th, 2009 at 9:51 pm

    Does not seem to work if you need the padding and the margin to be 0. I have a div that is 115px wide with a background image of a button.

    Inside that div is my input type of submit. I have a class that sets the padding of that to 0px. But IE wants to add 10px to the left-hand side, no matter what I try.

    Firefox and every other browser work perfectly.

    Oh well. Hopefully someone else has seen this bug before and knows a fix.

  16. 16 Dhiraj Aug 6th, 2009 at 3:16 pm

    Hi,

    great solution!! Thanks..

    It will be also great if someone comes up with a solution to avoid the clicking(the button moves in and out when clicked)

  17. 17 Rob Williams Aug 13th, 2009 at 11:03 am

    Thanks for that! Nice little hack for stupid IE :-p

  18. 18 Guru Aug 20th, 2009 at 8:56 am

    Guys this sucks. my submit button is not working when its an image in internet explorer.
    the code is as follows

    hey help there

  19. 19 Foo Aug 27th, 2009 at 1:05 pm

    BLESS you, Mr. Kirkland. I mean, really, “overflow: visible” is so achingly intuitive, and yet somehow I overlooked it. (Sarcasm, dripping. “Clean up on aisle 7!”)

    Seriously… you’re a hero.

  20. 20 wynne Sep 18th, 2009 at 2:11 am

    thanks for saving me hours!

  21. 21 Gregor Oct 5th, 2009 at 1:14 pm

    d00d, your my hero! Thanks for that!

  1. 1 IE7 Ignores Submit Button Padding - Twitter Homepage « XBDiff Blog Pingback on Jun 11th, 2009 at 12:39 am

Leave a Reply




About MrKirkland

more...

Tweets

Posting tweet...

Timezone

  • JST: 2010-03-11 08:56
  • GMT: 2010-03-10 23:56
  • PST: 2010-03-10 15:56
  • EDT: 2010-03-10 19:56