Change color of close button in bootstrap modal window

Bootstrap is setting the color like this:

.close {
  float: right;
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
  color: #000;
  text-shadow: 0 1px 0 #fff;
  filter: alpha(opacity=20);
  opacity: .2;
}

So you can override it with this:

.close {
    color: #fff; 
    opacity: 1;
}

In bootstrap 5 they have a class that allows you to change the color to white for the close button.

<button type="button" class="btn-close btn-close-white" aria-label="Close"></button>


Simple way you can override the defual x button in modal popup

  button.close {
        background: #d73e4d;
        background: rgba(215, 62, 77, 0.75);
        border: 0 none !important;
        color: #fff7cc;
        display: inline-block;
        float: right;
        font-size: 34px;
        height: 40px;
        line-height: 1;
        margin: 0px 1px;
        opacity: 1;
        text-align: center;
        text-shadow: none;
        -webkit-transition: background 0.2s ease-in-out;
        transition: background 0.2s ease-in-out;
        vertical-align: top;
        width: 46px;
    }

enter image description here


Just Write Down The Code

filter: brightness(0) invert(1);