Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Mar 2006
    Posts
    919
    Plugin Contributions
    2

    Default CSS Button Sizing Errors?

    Has anyone else noticed the 'sizing errors' of certain CSS buttons? Most of the buttons apear fine with the exception of...

    1 - The search buttons (contained in the search header)
    2 - The Add to cart button (on the product pages)

    Both of these buttons appear to be too wide and too high.

    Is there a fix for this or am I missing something?

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: CSS Button Sizing Errors?

    You should be able to adjust those as necessary to suit your site using the buttons stylesheet.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Nov 2003
    Location
    Haarlem | Netherlands
    Posts
    1,987
    Plugin Contributions
    15

    Default Re: CSS Button Sizing Errors?

    Hi Alex,

    if you remove all width settings form your current css buttons stylesheet, and replace it by this:
    Code:
    input.cssButton, input.cssButtonHover{
      /*  width: 0; needed to stop IE adding "magic" padding to the input */
      width: 0 !important;
      overflow: visible;  
    }
    input.cssButton[class], input.cssButtonHover[class] { /* IE ignores this [class]*/
      width: auto !important;
    }
    (the !important attributes are needed in this case to over ride the current inline styling of the buttons)

    The button width will be adjusted (depending on the amount of buttontext) by your browser.

    And adding height and line-height settings (often, but not always unfortunately) helps to get the same height for both link and input buttons:
    Code:
    .cssButton, .cssButtonHover{
      line-height: 1.5em;
      height: 1.5em;
    }
    (replacing exisiting height settings, line-height and height need to have the same value, and exsisting padding settings might have to be adjusted as well). You can try other sizes of course, as well as using px sizes (I am not sure if your font-sizes are currently in pixels).

    hth

  4. #4
    Join Date
    Nov 2005
    Location
    Colorado Springs, CO USA
    Posts
    7,033
    Plugin Contributions
    31

    Default Re: CSS Button Sizing Errors?

    Quote Originally Posted by paulm View Post
    Hi Alex,

    if you remove all width settings form your current css buttons stylesheet, and replace it by this:
    Code:
    input.cssButton, input.cssButtonHover{
      /*  width: 0; needed to stop IE adding "magic" padding to the input */
      width: 0 !important;
      overflow: visible;  
    }
    input.cssButton[class], input.cssButtonHover[class] { /* IE ignores this [class]*/
      width: auto !important;
    }
    (the !important attributes are needed in this case to over ride the current inline styling of the buttons)

    The button width will be adjusted (depending on the amount of buttontext) by your browser.

    And adding height and line-height settings (often, but not always unfortunately) helps to get the same height for both link and input buttons:
    Code:
    .cssButton, .cssButtonHover{
      line-height: 1.5em;
      height: 1.5em;
    }
    (replacing exisiting height settings, line-height and height need to have the same value, and exsisting padding settings might have to be adjusted as well). You can try other sizes of course, as well as using px sizes (I am not sure if your font-sizes are currently in pixels).

    hth
    Paulm,

    do you mean to delete the declarations such as:
    .button_submit {width: 18em;}
    There are several of these that define the width of the buttons.

  5. #5
    Join Date
    Nov 2003
    Location
    Haarlem | Netherlands
    Posts
    1,987
    Plugin Contributions
    15

    Default Re: CSS Button Sizing Errors?

    Quote Originally Posted by clydejones View Post
    Paulm,

    do you mean to delete the declarations such as:
    .button_submit {width: 18em;}
    There are several of these that define the width of the buttons.
    Yep, best to delete *all* width settings, then see how it works. And if needed add button specific styles afterwards again, but ususally there should be no real need to add any specific width settings (after adding the formentioned styles).

  6. #6
    Join Date
    Nov 2005
    Location
    Colorado Springs, CO USA
    Posts
    7,033
    Plugin Contributions
    31

    Default Re: CSS Button Sizing Errors?

    Paulm,

    Tried it on my test server and seems to be working just fine. Just need to play with the top/bottom padding.

    Many thanks

  7. #7
    Join Date
    Mar 2006
    Posts
    919
    Plugin Contributions
    2

    Default Re: CSS Button Sizing Errors?

    Quote Originally Posted by paulm View Post
    Yep, best to delete *all* width settings, then see how it works. And if needed add button specific styles afterwards again, but ususally there should be no real need to add any specific width settings (after adding the formentioned styles).
    Thanks for the info. I've tested this out and it works fine. However, the text is not centered in the buttons! It appears to be more to the left. Any easy fix for this?

    I've already got text-align set and that's not helping.

  8. #8
    Join Date
    Nov 2003
    Location
    Haarlem | Netherlands
    Posts
    1,987
    Plugin Contributions
    15

    Default Re: CSS Button Sizing Errors?

    Is it possible to post a link?

    Is it the same for all buttons, or just some that aren not centered? Maybe there are different left or right padding values added?

  9. #9
    Join Date
    Nov 2003
    Location
    Haarlem | Netherlands
    Posts
    1,987
    Plugin Contributions
    15

    Default Re: CSS Button Sizing Errors?

    I noticed an issue myself today.

    In firefox css buttons in table cells become as wide as the table cell itself Which is not always the desired width (I knew the formentioned solution was too easy to be true ;-) ).

    I do not think a clean and easy way around this issue exists, but I may be overlooking something.

    Two ways to solve this (I can think of now):

    1.) Change those (or all) buttons to "display: inline;". But, as far as I can see now, the height of buttons can not be set anymore then (?)

    2.) Set the width of those buttons in the stylesheet. Not really a problem of course, but I just hoped to be able to get rid of all button specific width settings :-)

  10. #10
    Join Date
    Jun 2006
    Posts
    122
    Plugin Contributions
    0

    Default Re: CSS Button Sizing Errors?

    i've also been trying to use the css buttons. they seem to look pretty good in firefox, but in IE the heights are all varied. has anyone been able to get the css buttons to look good in both firefox and ie?

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. EZ Pages Menu re-sizing in CSS
    By shellbell-19 in forum Templates, Stylesheets, Page Layout
    Replies: 15
    Last Post: 25 Mar 2011, 05:03 AM
  2. Login button mis-sizing
    By boy1da in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 9 Nov 2010, 02:32 PM
  3. sidebox css button sizing??
    By tlyczko in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 3 Mar 2010, 05:00 PM
  4. CSS Font Sizing Issue Sideboxes Different Please Help !
    By pasb in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 3 Jul 2009, 08:05 PM
  5. CSS Element for Add to Cart CSS button?
    By modernm in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 20 Jan 2008, 04:54 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR