哪个CSS属性会在Bootstrap 4模态的后台禁用活动? [英] What CSS property disables the activity in the background of a Bootstrap 4 modal?

查看:62
本文介绍了哪个CSS属性会在Bootstrap 4模态的后台禁用活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道可以使用哪些属性或一组属性来停用,模糊甚至使Bootstrap模态后面的背景变暗.

I would like to know what property, or sets of properties, can be used to deactivate, blur or even put darker the background behind a Bootstrap modal.

我有兴趣在其他地方使用这些相同的属性,但是在使用inspect元素(开发人员工具)时却找不到它们.

I am interested in using those same properties somewhere else but I am having trouble finding them when using inspect element (developer tools).

希望你们能有所帮助.预先感谢!

Hoping you guys can help. Thanks in advance!

推荐答案

创建了一个div .modal-backdrop,它负责此操作...尝试改变此div的颜色或不透明度

A div .modal-backdrop is created which is responsible for this... play around to change the color or the opacity of this div

.modal-backdrop {
  background: rgba(161, 247, 174, 0.9) !important;
  opacity: 0.3 !important;
}

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>


<div class="container">
  <h2>Modal Example</h2>
  <!-- Button to Open the Modal -->
  <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal">
    Open modal
  </button>

  <!-- The Modal -->
  <div class="modal" id="myModal">
    <div class="modal-dialog">
      <div class="modal-content">

        <!-- Modal Header -->
        <div class="modal-header">
          <h4 class="modal-title">Modal Heading</h4>
          <button type="button" class="close" data-dismiss="modal">&times;</button>
        </div>

        <!-- Modal body -->
        <div class="modal-body">
          Modal body..
        </div>

        <!-- Modal footer -->
        <div class="modal-footer">
          <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
        </div>

      </div>
    </div>
  </div>

</div>

这篇关于哪个CSS属性会在Bootstrap 4模态的后台禁用活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆