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”>

//…

</div>

</div>

</div>

  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;

Min-height:246px;

width:100%;

margin:auto;

color: #fc0;

line-height:20px;

}

  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;”>

<p>admin@fishshop.com</p>

<p>info@ fishshop.com</p>

</span>

</div>

  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”>

</span>

  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-wrap{

width:960px;

margin:auto;

}

.footer-content{

width:960px;

margin:auto;

overflow:hidden;

padding-top:10px;

}

.footer-content p{

font-size:16px;

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:

.email{

width:330px;

float:left;

}

  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>1.646.393.7800</p>

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

</span>

</div>

  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”>

</span>

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

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

.contact{

width:270px;

float:left;

}

  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”>

<ul><span>Services</span>

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

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

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

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

</ul>

</div>

  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;

text-decoration:none;

}

  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{

padding-bottom:2px;

color:#fff;

}

  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;

text-decoration:none;

}

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>

</ul>

</div>

  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:

.footer-info{

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:

.footer-info{

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:

.foot-divider{

height:130px;

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

float:left;

background:#c1c0b9;

}

  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 Fishshop.com.

All rights reserved.

</p>

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

</div>

  1. The footer now appears with the copyright section:

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

.footer-bottom{

text-align:center;

margin:auto;

padding-bottom:40px;

width:620px;

}

  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 *