Gradient Image Overlays With CSS3

Hey Pixels! In this week’s tutorial, I’m going to be showing you how to create a stylish gradient overlay to add to your website images using CSS3. Applying gradient overlays to your images adds a trendy pop of colour without ever having to open up Photoshop. In this tutorial, I’ll be showing you four trendy gradient overlay looks that you can use on your images for your own personal web design projects.

The HTLM

The HTML in this tutorial is going to be really simple! All we’re going to use is the <div> tag and then give it a class called “color-overlay”. We’re going to be inserting the image in our CSS code.

The CSS3

The CSS3 is where all the magic is going to happen. First, we’re going to select the color-overlay class and set its dimensions using the width and height properties. Then, with the same class selected (.color-overlay), we’re going to use the background property and then the linear-gradient property so we can use rgba values that will add the gradient to the image. Be sure to note the “a” value in the rgba values (0.45 below)–this sets the opacity of the gradient making the image below show through. Below the linear-gradient property, we can then add the actual image.

nyc_building
Original Image – Feel free to save this image for practice

blue-building

Gradient Overlay Styles

Take a look at the different gradient styles in the codes below to see some cool variations that you can use. It’s important to note that the original image is a black and white photo. Using a black and white photo to apply the gradient overlay will really bring out the effect.

Style #1 – Electric Cool

screen-shot-2016-10-09-at-12-41-41-pm

Style #2 – Tropical Breeze

screen-shot-2016-10-09-at-12-53-56-pm

Style #3 – Oceana

screen-shot-2016-10-09-at-1-00-27-pm

Style #4 – Serenity

screen-shot-2016-10-09-at-1-07-59-pm

Show & Tell!

Feel free to share some of your own gradient image overlay creations in the comments below. Simply take a screenshot or upload a photo and show it off!

Leave a Reply

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

More On XO PIXEL