Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS: Size of buttons in Chrome is different than Firefox

Tags:

I have the following HTML code:

<style type="text/css"> .submitbutton{margin-left:-2px;padding:1px} </style> ... <form>  ...  <input class=submitbutton type=submit value="Create Listings" />  </form> 

In Firefox, the input button has more padding than in Chrome.

Any ideas why?

UPDATE: If you're wondering why I have the negative margin - it's because between the input field and the input button - there is too much space.

like image 426
Hank Avatar asked Jun 02 '10 02:06

Hank


People also ask

How do I make all buttons the same size CSS?

CSS can be used to make buttons the same height by using the CSS property “height”. By setting the height of the button to a specific value, all buttons will be that height.


2 Answers

/* Remove button padding in FF */ button::-moz-focus-inner {     border:0;     padding:0; } 

You'll get the same button appearance in Chrome and Firefox.

like image 119
Jeaf Gilbert Avatar answered Oct 18 '22 11:10

Jeaf Gilbert


Even though you as a developer test in different browsers and see the difference in buttons, the user will not. It's too easy to get focused on things that users won't notice: the user likely has either Firefox or else IE or else Chrome, but not all of them. Rarely do users ever switch browsers over time let alone switch between them and complain about a few pixels diff.

So if you consider the buttons and the experience in just one browser at a time, and if it works well in that experience/browser, then don't bother spending more time. Instead move onto next steps.

This doesn't answer 'why' but somebody else explained that one.

like image 43
John K Avatar answered Oct 18 '22 12:10

John K