Categories
CSS

How to change background Opacity when bootstrap modal is open with CSS?

Spread the love

Sometimes, we want to change background opacity when Bootstrap modal is open with CSS.

In this article, we’ll look at how to change background opacity when Bootstrap modal is open with CSS.

How to change background opacity when bootstrap modal is open with CSS?

To change background Opacity when Bootstrap modal is open with CSS, we set the opacity style in the modal-backdrop class.

For instance, we write

.modal-backdrop {
  opacity: 0.5 !important;
}

to set the elements with class modal-backdrop to have opacity 0.5.

Conclusion

To change background Opacity when bootstrap modal is open with CSS, we set the opacity style in the modal-backdrop class.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

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