Footer Layout in OpenCart: Footer with a gradient image

We have seen a wide footer in our previous recipe. In this recipe, we will create another footer with a gradient image as the footer background. We will add the contact information, telephone numbers, and some useful links in the footer.

1. Getting started

We open up the footer.tpl file under catalog\view\theme\shop\template\common with our favourite editor.

2. How to do it

We will follow these steps:

  1. We first create a footer container in the footer ID of our HTML The containing code is placed below:

<div id=”footer”>

<div class=”footer-wrap”>

<div class=”footer-content”>





  1. For the footer ID, we will create a background image with the dimension 2×247. We choose #c6a50c as the foreground colour and #987e04 as the background color:

  1. Now, we will choose the gradient tool from the tool box of GIMP:

  1. We apply the selected colours with the gradient tool from top to We save the image as footer.png. We use some styling for our footer block in our stylesheet.css:

/* Footer */ #footer {

border-top: 1px solid #d0d3d8; padding: 0.5em 0;

clear: both;

background: transparent url(‘catalog/view/theme/shop/image/ footer.png’) repeat-x top left;




color: #fc0;



  1. If we refresh our browser, we get our footer as this:

  1. Our first container block will be the email We add the following code

block there:

<div class=”email”>

<span style=”padding: 40px 40px 0px 10px;”>





  1. So, the footer appears as follows:

  1. We will add an image icon for the email We searched the Internet and chose the following image. You can find your favorite one.

  1. And apply the following code in our tpl:

<span style=”float: left;”>

<img height=”90″ width=”80″ src=”catalog/view/ theme/shop/image/myemail.png” alt=”Email”>


  1. Then, the footer becomes like this:

  1. Our email block is at the top left corner, we will do some styling with See the following styles:











.footer-content p{


text-align: center;


  1. This makes our email block more See the following image:

  1. We add a width property for the email Here is the width code:





  1. Now, the email block appears like this:

  1. We now add the phone block to the footer:

<div class=”contact”>

<span style=”padding: 0px 40px 0px 10px;”>


<p>880197<span class=”phone-word1″ style=”display: inline;”></span></p>



  1. In the browser, the footer becomes:

  1. We also add another image icon for the phone We get the following image icon:

  1. And add the following code, we can also use the css background property to use icons:

<span style=”float: left;”>

<img height=”80″ width=”60″ src=”catalog/view/ theme/shop/image/myphone.png”>


  1. When we refresh our browser, it looks like this:

  1. Now, we add the following style code block for the contact section:





  1. This makes our footer look like the following:

  1. Now, add the Services block into our footer Here is the HTML code block for that:

<div class=”footer-info”>


<li><a href=”#”>Home</a></li>

<li><a href=”#”>Gallery</a></li>

<li><a href=”#”>Location</a></li>

<li><a href=”#”>Contact</a></li>



  1. In the browser, we found it as this:

  1. We need to do some styling to our list items for the services block:

#footer li a{

color: #fc0;



  1. This brings the following changes to our site footer:

  1. There needs to be some spacing between the footer So, we apply some padding there too:

.footer-info ul li{

padding: 5px 5px 0px;


  1. When we go to the browser, it looks like this:

  1. We apply a different colour for the services block

.footer-info span{




  1. It makes the services header look like this:

  1. You can apply a bottom border to the service block For this, we will apply the following style:

.footer-info span{

border-bottom:1px solid #ffffff;


  1. It brings a bottom border to the service block

  1. We use a hover colour for the service block We add the following style code for this purpose:

#footer li a:hover{

color: #f7f888;



This brings about the following changes to the footer:

  1. This completes the service block We now add another block site-info to the footer:

<div class=”footer-info”>

<ul><span>Site Info</span>

<li><a href=”#”>Privacy</a></li>

<li><a href=”#”>Terms & condition</a></li>

<li><a href=”#”>FAQ</a></li>



  1. Let’s refresh our browser, we will find our footer as follows:

  1. There will be a float property for the site-info block:


float: left;


  1. The blocks now become like the following:

  1. Still the blocks are too close to each So, we apply a width for the information blocks:


width: 150px;

float: left;


  1. So, our footer now displays the following contents:

  1. Now, place a divider between each section of the We can also use the border colour to create a divider effect:

<div class=”foot-divider”> </div>

We add the following styling for this:



width:1px; margin:0px 20px;




  1. In the browser, our footer now is like the following image:

  1. At the bottom, we add the copyright section at the Following is the HTML code block:

<div class=”footer-bottom”>

<p class=”copyright”>Copyright &copy; 2010

All rights reserved.


<p class=”copyright”> developed by: ABCD</p>


  1. The footer now appears with the copyright section:

  1. For the bottom class, we apply the following style code:







  1. This makes our footer bottom like this:

  1. We will add a site logo on the footer For this, we need to have the following img tag:

<img alt=”Your Store” title=”Your Store” src=”http://localhost/ opencart/image/data/shops.png” />

  1. We can view the footer with our site logo now:

Source: Hasan Tahsin (2011), OpenCart 1.4 Template Design Cookbook, Packt Publishing.

Leave a Reply

Your email address will not be published. Required fields are marked *