ECommerce Insights Blog

Stay on top of it all and get ahead with useful articles, how-tos, tips and tricks on e-commerce.

How To Create CSS Image Buttons In Your Magento Themes


Many developers and store owners don’t like to use images as buttons simply because they do not wish their users to wait until the images load. Image buttons gives the flexibility to display images as per store’s requirement but these days lots and lots of stores are opting to create CSS image buttons rather than image buttons. With a very little tweak you can get rid of image buttons in your theme and switch to CSS buttons. If you are willing to change your image buttons to CSS powered buttons then follow the steps given below:

Take a nice background image which is blank and nothing written on it. We will use this background image to generate text over it. Basically, if you follow CSS buttons you don’t have to create separate images for each button. Download the background image given below for an example (you can create your own image background).

btn-proceed-to-checkout-bg btn-proceed-to-checkout-rad

In your theme template you will find various instances where you have to change image button to CSS button. For an example we will take “Proceed to Checkout” button code app/design/frontend/default/Your_theme/template/checkout/onepage/link.phtml

By default you will see something like this (if you are using default theme)

<?=__('Proceed to Checkout')?>

Now, we will use CSS and HTML to tweak and change the background for this button.

__('Proceed to Checkout');?>

Note: if you are using v 1.7 then change like this

__('Proceed to Checkout')?>

You will notice that we have called css-button class along with btn-checkout which will enable us to change font color or size later if needed. Your CSS button is ready. Now, lets write the CSS for this button

.btn-checkout {
background:transparent url(../images/btn_proceed_to_checkout_rad.gif) no-repeat 100% 0;
.btn-checkout, .btn-checkout:hover {
.btn-checkout span {
padding:0 17px 0 25px;
background:transparent url(../images/btn_proceed_to_checkout_bg.gif) no-repeat;

You are done, your CSS button is ready, just clear your cache and see the CSS button.

Similarly, you can change the buttons of other instances like Add To Cart etc. E.g. app/design/frontend/default/your_theme/template/checkout/onepage/review.phtml

change this


__('Place Order') ;?>

Changing image buttons to CSS buttons is an easy task if you follow the steps given above but make sure that you switch to all instances of image buttons to CSS one’s otherwise your store might look awkward. Please leave me a comment and let me know if this trick helped you to convert your Magento store image buttons to CSS buttons. Don’t forget to subscribe our RSS to receive latest updates delivered to your mailbox.