How to add an image gradient overlay using CSS

CSS

Add an image to a div

Adding a background image to a <div> is easy using CSS

<body>
    <div class="image"></div>
</body>
#image {
    background-image: url('images/background.jpg');
    background-size: cover;
    width: 1024px;
    height: 450px;
}

Add a gradient overlay to this image

#image {
    background-image: 
        linear-gradient(to bottom, rgba(245, 246, 252, 0.50), rgba(117, 19, 93, 0.75)), 
        url('images/background.jpg');
    background-size: cover;
    width: 1024px;
    height: 450px;
}

Back to Top

I am actually playing with NextJS, some contents are not available yet ! See the v1