Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Buttons too tall on Firefox

Tags:

css

firefox

gecko

I've got a problem unique to Firefox. I'm trying to style links and buttons to look exactly the same. On every browser except Firefox, this works as desired. On Firefox, the height of the button's content is 18 pixels, compared to 15 pixels for the link. On Chrome, Safari, and Internet Explorer, they're both the proper 15 pixels tall. Why is this?

Here's a demo on jsFiddle of the problem. Here's the result I get on Chrome:

Result on Chrome

and here's the Firefox result:

Result on Firefox

I've tried changing the height manually in CSS, but that doesn't entirely work and breaks the layout on other browsers. Setting -moz-appearance: none does nothing, but then again, it usually doesn't.

Here's a full detail of my attempt, too, and what it's going to be used for.

Has anyone come across this problem before? How can I equalize the height across all browsers?

like image 370
Ry- Avatar asked Jan 14 '12 03:01

Ry-


2 Answers

Found another user who used this:

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

http://jsfiddle.net/MCAllinder/dehda/2/

like image 102
lambgrp425 Avatar answered Nov 07 '22 08:11

lambgrp425


I've found a complete solution and wrote about it here:

http://davidwalsh.name/firefox-buttons

input::-moz-focus-inner { 
    border: 0; 
    padding: 0; 
    margin-top:-2px; 
    margin-bottom: -2px; 
}

You need to modify the margin-top and margin-bottom to match your other buttons

like image 22
David Walsh Avatar answered Nov 07 '22 10:11

David Walsh