将模式背景更改为黑色

Change Modal Background to black

您好,我使用 bootstrap 3 作为模态

我想更改模态框的背景颜色

这是html代码

<div class="modal fade modal-white" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Enter code to access form</h5>
        {{--  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>  --}}
      </div>
      <div class="modal-body">
        <div class="alert alert-danger" id="alertThis" role="alert" style="display:none;">
          Invalid code please try again ..
        </div>
        <input name="clients" class="clients form-control" type="password" id="inputCode" placeholder="Code">
      </div>
      <div class="modal-footer" style="border:none!important;">
        
        <button type="button" onClick="proceedCode();" id="proceedCode" class="btn btn-primary">Enter</button>
        <a class="btn btn-secondary" href="{{url('/')}}">Cancel</a>
      </div>
    </div>
  </div>
</div>

和示例输出

我想将背景颜色设置为全黑,并且只能看到模态框。是否有我需要添加的 class,尝试使用 modal-backdrop 和 modal-white class 对其进行调整,但它不起作用。

在您的 css 文件中试试这个

.className {
background-color: black !important;
}

尝试一下,希望对您有所帮助。

#exampleModal {
  background-color: black;
}