1

I am using some css styling for my submit buttons, and they look fine except in Firefox there is a space between the left and main image. Here is what I'm using:

button.buttons {
background: none;
background-image: url(images/button_left_sprite.png);
display: block;
border: none;
margin: 0 10px 10px 0;
padding: 0 0 0 17px;
cursor: pointer;
font-weight:normal!important;
color: #111111;
}
button:hover.buttons {border: none; }
button.buttons span {
background-image: url(images/button_sprite.png);
padding: 9px 20px 10px 5px;
font: 12px 'Droid Sans',arial,sans-serif;
}
/* Green Button */
button.btn_green {background-position: 0 569px;color: #435425;}
button.btn_green:hover {color: #435425!important;}
button.btn_green span { background-position: 100% 569px;}
button:hover.btn_green { background-position: 0 528px;background-color:transparent!important; }
button:hover.btn_green span { background-position: 100% 528px;background-color:transparent!important; }​

And to put it on the page:

<button type="submit" class="buttons btn_green left"><span class="left">Update</span></button>​

If it helps, the images are here:

http://i41.tinypic.com/dv1b6.png

http://i41.tinypic.com/2mcds8j.png

Im going bonkers trying to get this ugly space to go away in Firefox! Can anyone help me figure out why it's doing this?

Sparky
98.8k26 gold badges202 silver badges293 bronze badges
asked Mar 19, 2012 at 17:21
1
  • 1
    Are you unable to use CSS3? If you could, you didn't need to go through all that work to style a button. Plus you could use a visual generator (ex: css3button.net ) Commented Mar 19, 2012 at 17:24

3 Answers 3

1

Firefox has some abnormalities when it comes to button/input padding. I'm not sure why it is the case, and why the issue remains despite being publicly documented. Anyway, check out something like normalize.css and check out the section on forms - for instance, this is one fix they apply for firefox:

button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}

Being that your left sprite depends on 17px of left padding on .buttons, if FF adds a couple pixels by default, that could mess with your images aligning. Another thing you could try is reducing the amount of left padding and see if the images line up.

Does that help?

answered Mar 19, 2012 at 17:29
Sign up to request clarification or add additional context in comments.

Comments

0

Is it only for me that the button looks totally messed up in firefox? not just a space between the images.

Looks better for me like that: http://jsfiddle.net/78eSc/1/

button.buttons {
 background: none;
 background-image: url('http://i41.tinypic.com/dv1b6.png');
 display: block;
 border: none;
 margin: 0 10px 10px 0;
 padding: 0 0 0 14px;
 cursor: pointer;
 font-weight:normal!important;
 color: #111111;
}
button.buttons span {
 display:block;
 background-image: url('http://i41.tinypic.com/2mcds8j.png');
 padding: 9px 20px 10px 5px;
 margin:-1px 0 0 0;
 font: 12px 'Droid Sans',arial,sans-serif;
}
answered Mar 19, 2012 at 17:32

1 Comment

Alex,Thanks for this. It looks good in Firefox, but now it looks strange in other browsers. :(
0
Sparky
98.8k26 gold badges202 silver badges293 bronze badges
answered Mar 19, 2012 at 17:30

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.