我的模态有问题,它显示黑色背景而不是透明背景。 这可能是与 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">×</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 output
最佳答案
正如我所看到的,Bootstrap 有类 .modal-backdrop
并且他们将背景颜色设置为黑色,您可以使用以下代码覆盖它:
.modal-backdrop {
background-color: rgba(0,0,0,.0001) !important;
}
关于html - 如何创建具有透明背景的 Bootstrap 模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44155471/