{"id":502,"date":"2010-10-26T15:50:26","date_gmt":"2010-10-26T23:50:26","guid":{"rendered":"https:\/\/www.numinix.com\/blog\/?p=502"},"modified":"2024-12-24T13:22:24","modified_gmt":"2024-12-24T20:22:24","slug":"css-buttons-vs-image-buttons-in-zen-cart","status":"publish","type":"post","link":"https:\/\/www.numinix.com\/blog\/css-buttons-vs-image-buttons-in-zen-cart\/","title":{"rendered":"CSS Buttons vs Image Buttons"},"content":{"rendered":"<p>Using Image Buttons versus CSS Buttons is more than just a design issue, but also can greatly affect the performance of your server and your customer&#8217;s impression of the speed of the website.<\/p>\n<p>In <a href=\"https:\/\/www.numinix.com\/expert_zen_cart_developers.html\">Zen Cart<\/a>, when configuring your store, you have the option in ADMIN-&gt;CONFIGURATION-&gt;LAYOUT SETTINGS to select whether or not to use CSS buttons.\u00a0 A CSS button is a button generated using rules in a CSS stylesheet instead to using images as buttons.<\/p>\n<p>Let&#8217;s take a look at some of the advantages and disadvantages of each option.\u00a0 Note that these characteristics are not isolated to Zen Cart websites but all websites in general.<\/p>\n<h2>Image Buttons<\/h2>\n<p>Example of a submit button using an image:<\/p>\n<pre lang=\"html4strict\" escaped=\"true\">&lt;input type=\"submit\" src=\"http:\/\/www.domain.com\/images\/button_submit.jpg\" alt=\"Submit the Form\" value=\"Submit the Form\" \/&gt;<\/pre>\n<p>Example of a link button using an image:<\/p>\n<pre lang=\"html4strict\" escaped=\"true\">&lt;a href=\"http:\/\/www.domain.com\/index.php\" title=\"Some Page\"&gt;&lt;img src=\"http:\/\/www.domain.com\/images\/button_link.jpg\" \/&gt;&lt;\/a&gt;<\/pre>\n<p><strong>Advantages<br \/>\n<\/strong><\/p>\n<ul>\n<li>They are generally pretty easy to setup.\u00a0 You merely have to replace the existing Zen Cart button set with your new button set and modify includes\/languages\/english\/button_names.php with any file name changes (i.e. .gif is now .jpg).<\/li>\n<li>When you&#8217;d like to make a change to a button, you can just replace that individual file.<\/li>\n<li>They are very easy to position as you only need a single input or button element to style.<\/li>\n<\/ul>\n<p><strong>Disadvantages<\/strong><\/p>\n<ul>\n<li>For every individual button, you&#8217;ll need to create a separate image and maintain these images on your server.\u00a0 Even if the image is<\/li>\n<li>For every instance of a button on your website the customer will have to download this image from your server.\u00a0 Each object that has to be downloaded from your server adds additional latency to the page loading time, regardless of the size of the object.<\/li>\n<li>Adding events such as an <em>onmouseover <\/em>event is difficult and often needs <em>JavaScript<\/em>.\u00a0 The mouseover image also must be downloaded separately for every button.<\/li>\n<li>If you need to make a change to all of your buttons, you&#8217;ll need to replace every image.<\/li>\n<\/ul>\n<h2>CSS Buttons<\/h2>\n<p>Example of a submit button using <a href=\"https:\/\/www.numinix.com\/css-js-loader\">CSS<\/a> (note the JavaScript is used for IE6 which does not support attaching a hover event to anything other than a link):<\/p>\n<pre lang=\"html4strict\" escaped=\"true\">&lt;button onmouseout=\"this.className='cssButton button_submit'\" onmouseover=\"this.className+=' cssButtonHover\u00a0 button_submit\u00a0 button_submitHover'\" style=\"width: 72px;\"&gt;&lt;span&gt;Search&lt;\/span&gt;&lt;\/button&gt;<\/pre>\n<p>Example of a link button using CSS:<\/p>\n<pre lang=\"html4strict\" escaped=\"true\">&lt;a title=\"Zen Cart Modules by Numinix\" href=\"https:\/\/www.numinix.com\/downloads\/zen-cart-modules\"&gt;&lt;span onmouseout=\"this.className='cssButton'\" onmouseover=\"this.className+=' cssButtonHover\u00a0 Hover'\" style=\"width: 96px;\" id=\"navDownloads\"&gt;&lt;span&gt;Downloads&lt;\/span&gt;&lt;\/span&gt;&lt;\/a&gt;<\/pre>\n<p><strong>Advantages<\/strong><\/p>\n<ul>\n<li>Background image are reused for each button and only have to be downloaded once.<\/li>\n<li>Styling one button differently than another is just a matter of applying styles to the id selector thus overriding the class selector.<\/li>\n<li>Hover (<em>onmouseover<\/em>) events do not need <em>JavaScript <\/em>and can use the same image for every button.<\/li>\n<li>Making changes to all of the buttons is as easy as editing the button class.<\/li>\n<\/ul>\n<p><strong>Disadvantages<\/strong><\/p>\n<ul>\n<li>Initial setup requires a web designer to create a stylesheet for the button class and each individual button that needs distinguishing features from the others (i.e. different background color).<\/li>\n<li>Positioning the buttons using CSS can be difficult depending on your button design and the number of elements used to create the button.\u00a0 In older browsers like IE6 and IE7 it can be particularly difficult and you may find you either need to use browser specific stylesheets or you have to rewrite your stylesheet code.<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>When it comes to website speed, CSS buttons are king over Image buttons because they require way less downloadable objects to create the set of buttons.\u00a0 Often the buttons will use the same background image and same hover image which means only 2 objects need to be downloaded.\u00a0 Even if they don&#8217;t you can always use a CSS sprite to combine all of the different background images for your button variations into a single downloadable object.\u00a0 Maintaining all of your buttons as a whole is also very easy as you will only need to modify your button class.\u00a0 The biggest impediment of CSS buttons is the skill of the web designer and their knowledge of CSS.\u00a0 Thus, if you are not very familiar with CSS, you may be stuck with Image buttons.\u00a0 Another difficulty is making a CSS button look fancy using icons that change from button to button.\u00a0 It is a lot easier to use an Image button in this case.<\/p>\n<p>So, there you have it.\u00a0 The end results of CSS buttons are, in my opinion, superior to Image buttons, but they take a lot more work to setup.\u00a0 The great thing is that once they are setup, CSS buttons are easy to maintain.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using Image Buttons versus CSS Buttons is more than just a design issue, but also can greatly affect the performance of your server and your customer&#8217;s impression of the speed of the website. In Zen Cart, when configuring your store, you have the option in ADMIN-&gt;CONFIGURATION-&gt;LAYOUT SETTINGS to select whether or not to use CSS&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[6,3],"tags":[213,58,9,8],"class_list":["post-502","post","type-post","status-publish","format-standard","hentry","category-visual-design","category-zen-cart-optimization","tag-buttons","tag-css","tag-web-design","tag-zen-cart"],"modified_by":"Nurul Afsar","jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/posts\/502","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/comments?post=502"}],"version-history":[{"count":0,"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/posts\/502\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/media?parent=502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/categories?post=502"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/tags?post=502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}