How to darken a background using CSS?

Spread the love

Sometimes, we want to darken a background using CSS.

In this article, we’ll look at how to darken a background using CSS.

How to darken a background using CSS?

To darken a background using CSS, we sety the linear-gradient.

For instance, we write

body {
  background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)),
    url(https://images.unsplash.com/photo-1614030424754-24d0eebd46b2);
}

to add a dark background with an image at the bottom.

Conclusion

To darken a background using CSS, we sety the linear-gradient.

Leave a Reply

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