Instead of adding a color overlay to the background image using Photoshop, you can actually use CSS to do that.

Having the CSS to work with this, it’s easy for someone to just upload an image. The same CSS adds style to the image rather than using an image editor every time.

There are many ways you can achieve this color overlay filter effect with CSS, such as:

  1. Background Blend Mode (background-blend-mode property)
  2. Mix Blend Mode (mix-blend-mode property)
  3. Layering Background Image with Color
  4. CSS Grayscale Filter

First of all, the image below is the one we are going to use in all of the methods.

Background Blend Mode (background-blend-mode property)

So, how to use background-blend-mode property?

The idea of a background blend mode is you have to add a background color and also a background image and blend it together.

Well, that was not it – you can choose the different blending modes you like.

You can also add two different images in one container and blend it together.

For example:

  1. .container {
  2. background-image: url("image-a.jpg"), url("image-b.jpg");
  3. background-repeat: no-repeat, repeat;
  4. background-blend-mode: color;
  5. }

If you are familiar with using Photoshop, you notice that there are different blending modes option to choose from. In css, it might not actually works like every blending modes in Photoshop however most of them functions in similar way.

See video:

Here are the list of CSS Blend modes you can use:

  • color
  • color-burn
  • color-dodge
  • darken
  • difference
  • exclusion
  • hard-light
  • hue
  • lighten
  • luminosity
  • multiply
  • normal
  • overlay
  • saturation
  • screen
  • Soft-light

See example below:

  1. .container {
  2. width: 600px;
  3. height: 400px;
  4. background-image: url("image-a.jpg");
  5. background-repeat: repeat;
  6. background-color: red;
  7. background-blend-mode: exclusion;
  8. }

Result:

background-image-color-overlay-color-filter-effect-exclusion

Note: There is a disadvantage in using this method as Internet Explorer do not support background-blend-mode property.

Mix Blend Mode (mix-blend-mode property)

Mix blend mode is the same as the background blend mode property. The only difference is mix blend mode specifies how the child element content should blend with its background.

See example below:

  1. .container {
  2. background-color: red;
  3. }
  4.  
  5. .container img {
  6. mix-blend-mode: multiply;
  7. }

Result:

Note: Internet explorer do not support mix-blend-mode css property.

Layering Background Image with Color

Personally, I think this is the best method to use when creating a CSS background image color overlay filter effect.

See example below:

  1. Please Subscribe!

  • </div>
    1. .container{
    2. width: 100%;
    3. height: 500px;
    4. background:url(image.jpg);
    5. background-size: cover;
    6. background-position: center;
    7. display: flex;
    8. position: relative;
    9.  
    10. }
    11.  
    12. h1{
    13. color: #fff;
    14. font-family: sans-serif;
    15. text-align: center;
    16. font-size: 60px;
    17. }
    18.  
    19. .content{
    20. position: absolute;
    21. left: 0;
    22. right: 0;
    23. }
    24.  
    25. .container:before {
    26. content: "";
    27. background: #80007b;
    28. width: 100%;
    29. opacity: .5;
    30. transition: .5s ease;
    31. }
    32.  
    33. .container:hover:before{
    34. background: #58ffd2;
    35. }

    We want to keep our  :before container dimensions the same with the parent. Therefore, we add a display:flex to it

    Result:

    Subscribe to our youtube channel: Garnatti one!

    See video:

    Other example results:

    22bulbjungle-CSS background image color overlay Hello-baby-22bulbjungle-css-background-image-color-overlay CSS background image color overlay css_color_filter_overlay

    CSS Grayscale Filter

    Although this method only makes an image into a grayscale color, it would be easier if you use this method if you prefer a black and white image filter.

    See example:

    1. Img{
    2. -webkit-filter: grayscale(100%);
    3. filter: grayscale(100%);
    4. }

    Result:

    background-image-color-overlay-color-filter-effect-grayscale

    You can adjust the value percentage of the property. The higher the value the darker the image would become.

    See video:

    Note: Internet Explorer and Safari 5.1 and earlier do not support filter CSS property.

    In conclusion, there are a lot of ways you can achieve a color filter effect to a background image using CSS. This just depends on whichever you want it.

    Speaking of background image color overlay, you might also be interested in image hover effects and other background image tutorials using pure CSS.

    See videos below: