How to add background color to news titles on homepage in nopCommerce

Many developers / web designers are always looking to improve or add something new in the website layout / design that makes the content of the site stand out. nopCommerce homepage (out of the box) offers 3 latest news posts on the homepage. Adding some background color to the titles will certainly make it look more attractive and it will easily catch your customer's attention.

nopCommerce already offers a great modern theme that has been designed to keep up with the latest designing trend. But, there is always some room for improvement or change. Today, we will go over the process of adding background color to news titles on homepage in nopCommerce.

This is the default layout / design of the homepage news posts:

nopcommerce news



In order to add background color, open the stylesheet of your default theme:
Nop.Web/Themes/DefaultClean/Content/css/styles.css


nopcommerce news


In your "styles.css", find this:

.post-title,
.news-title {
    display: inline-block;
    padding: 20px 10px;
    line-height: 20px;
    font-size: 16px;
    font-weight: bold;
    color: #444;
}



Now, lets separate it first like this so that any changes that we are making to news title does not affect anything else on the website.

.post-title {
    display: inline-block;
    padding: 20px 10px;
    line-height: 20px;
    font-size: 16px;
    font-weight: bold;
    color: #444;
}
 
 
.news-title {
    display: inline-block;
    padding: 20px 10px;
    line-height: 20px;
    font-size: 16px;
    font-weight: bold;
    color: #444;
}




Now, simply add your styling to the news-title class as per your requirements. In this example, we are using "skyblue" color and 300px width like this:

.news-title {
    display: inline-block;
    padding: 20px 10px;
    line-height: 20px;
    font-size: 16px;
    font-weight: bold;
    color: #444;
    background-color:skyblue;
    width:300px;
}




That's all - Now save changed and see the result on your homepage. It should look something like this:


nopCommerce news

A copy of this article is also available on Arvixe Blog.

About Author

Written By Lavish Kumar

Based out of New York, USA, Lavish Kumar is a full stack web developer by profession and founder of Striving Programmers, a trusted community for developers that offers a wealth of articles and forums to assist individuals with improving their software development skills.

Leave your comment