12

How do I get my <button>s to look consistent in Firefox and Chrome? Is there a non-conditional CSS solution? Right now, Firefox's buttons have extra padding even though YUI's CSS Reset made the padding 0.

HTML button

I discovered that to get the same appearance, Chrome needs to have double the padding.

            #fileActions button {
                padding: 0.2em;
            }

@media screen and (-webkit-min-device-pixel-ratio:0) {
            #fileActions button {
                padding: 0.4em;
            }
}

Chrome

Chrome computed style

Firefox

firefox computed style

JoJo
  • 19,587
  • 34
  • 106
  • 162

2 Answers2

4

Firefox gives buttons something called inner focus, this allows it to draw the dotted focus line. There is a rule in forms.css for it, which gives it 1px of border and 2px of left and right padding. I don't know whether it's possible to override this from a web page.

Neil
  • 54,642
  • 8
  • 60
  • 72
  • 1
    It is. The only drawback is that it will not get a dotted line when focused. http://stackoverflow.com/questions/5517744/remove-extra-button-spacing-padding-in-firefox/5518143#5518143 – 700 Software Apr 02 '11 at 11:23
  • @George Bailey Thanks for the link. – Neil Apr 02 '11 at 19:23
0

It´s hard to say without seeing your css, but if you check the css of the YUI reset, you will see that it does not set or reset any properties for the button element except for the inherited ones and that does not include padding as far as I know.

jeroen
  • 91,079
  • 21
  • 114
  • 132