Jump to content

CSS buttons using background image not showing right


richrock

Recommended Posts

I've got a background image for all my input submits, and these have all had the same class applied to them, but I still have a problem I cannot get my head around  :confused:

 

Here's the css bit:

.button_new {
    color: #FFFFFF;
    background-image: url('images/button-gradient.png') !important;
    background-position:left center;
    background-repeat: repeat-x;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    text-transform:uppercase;
    padding:1px 3px 1px 3px;
    min-height:17px;
}

 

The background image displays fine, it all works, apart from one thing:  FF, IE7 and IE8 all show different sized buttons.  My problem is, is that the buttons have varying text in them, eg Submit, Reset Search, Go, Back, Back to Listing etc.  It seems to ignore my padding rules, and setting a margin makes no difference either...

 

I found this rather useful link showing the differences between browser buttons, and BEFORE any styles are applied, there are differences.  Even between IE versions.  http://www.designdetector.com/demos/buttons-padding-demo.html

 

So does anyone have any ideas about getting the buttons to look the same across all browsers?  It's worth noting in my code that min-height actually seems to fix IE8's button heigh issues I had, but I don't want to spend another day trying to push a few px to make things look pretty....  >:(  I have also used a global reset to zero off the extra paddings/margins that each browser decides is necessary, so I am working from the ground up with any elements on the page. 

 

If possible I'd like to do this without conditional comments - I've managed many other things without resorting to that method and would like to keep my clean streak :D  I've included screenshots of the offending buttons to see my issue.

 

[attachment deleted by admin]

Link to comment
Share on other sites

And for what it's worth, this may well seem impossible :  :'(

 

I checked out http://jehiah.cz/sandbox/button.html and if you look closely, you can see that the buttons in the 'fixed' version are still a few px out either end...  Unless I change for fixed images, this ain't gonna happen I reckon.  :shrug:  I need a button to be an exact size in one place for all browsers based on the text being 'Search'...

 

Took a screenshot of IE & FF side by side so you can see...

 

[attachment deleted by admin]

Link to comment
Share on other sites

As mentioned in my OP - "I have also used a global reset to zero off the extra paddings/margins that each browser decides is necessary, so I am working from the ground up with any elements on the page. "  I have used the global reset for a number of sites, but it makes no difference. 

 

Further research shows that even Google's buttons render in differing sizes depending on browser.  Argh!  I'll try the size thing, but I think I'm running out of options.

Link to comment
Share on other sites

If I were you, if its that much of an issue, I would make it an image ( with the text on the image ), that way you are not dealing with margins or paddings.. not ideal I know, but it will bring the results you want as its not any text you would want picked up by search engines anyway.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.