如何使用透明背景创建bootstrap模式

Fat*_*a.S 5 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-->
Run Code Online (Sandbox Code Playgroud)

单击以查看输出

更新!! 它工作得很好.但是模态被放置在具有相同页面高度的玻璃盒中.我可以将其限制为高度,宽度属性,但我更愿意知道原因. 点击查看输出

Gal*_*oui 13

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

.modal-backdrop {
     background-color: rgba(0,0,0,.0001) !important;
}
Run Code Online (Sandbox Code Playgroud)