html - 如何创建具有透明背景的 Bootstrap 模式

标签 html css twitter-bootstrap

我的模态有问题,它显示黑色背景而不是透明背景。 这可能是与 CSS 相关的问题。 注意:我在 .fade 类中更改了 Opacity:.7 但这并没有影响任何东西

  <!-- Modal -->
    <div class="modal fade" id="myModal"  style="position:fixed; top:0px; left:800px;width:600px; background:none; " role="dialog">
    <div class="modal-dialog">

      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">

          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">Adding Wall</h4>
        </div>
        <div class="modal-body">
            <label>Wall Id:     </label><input type="text" id="wallNametxt"/><br>
         <label>Wall Name:</label><input type="text" id="wallNametxt1"/>

        </div>
        <div class="modal-footer">
          <input type="button" id="btn" value="Add!" name="save" class="btn btn-default"/>
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
      </div>

    </div>
  </div><!--End of Modal-->

Click to see the Output

更新!! 它工作得很好。但是模式被放置在一个与页面高度相同的玻璃盒子里。 我可以将其限制为高度、宽度属性,但我更想知道原因。 Click to see output

最佳答案

正如我所看到的,Bootstrap 有类 .modal-backdrop 并且他们将背景颜色设置为黑色,您可以使用以下代码覆盖它:

.modal-backdrop {
     background-color: rgba(0,0,0,.0001) !important;
}

关于html - 如何创建具有透明背景的 Bootstrap 模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44155471/

相关文章:

html - CSS 表格单元格填充困惑

html - 在div中垂直对齐图像和文本

css resolutions media queries - **单页网站**

javascript - 如何从 Bootstrap 模式捕获事件

html - Bootstrap 上的奇怪错误

jquery - 将 div 高度设置为手动更改之前的高度

css - 如何将css文件包含到compojure元素中?

html - 相对于屏幕而不是父元素调整 HTML 元素的大小

javascript - 带有 Primefaces (JSF) 的 Twitter Bootstrap

html - 纯 CSS 是否允许我制作一个包含一个大元素和等宽但不等高的后续元素的网格?