Bootstrap 模态是透明的

Bri*_*son 4 html css jquery twitter-bootstrap

我使用了我在教程中看到的内容,但我似乎遇到了问题,因为我在谷歌上阅读了其他帖子,但没有人帮助解决我的问题。我怎样才能使我的模式对话框不透明?

这是它的样子 http://i57.tinypic.com/20pr18w.png

这是我的代码

<div class="container">
    <div class="row text-center">
        <h3>Picture</h3>
        <a href="#" class="btn btn-lg btn-success" data-toggle="modal" data-target="#basicModal">Upload a photo</a>
    </div>
</div>

<div class="modal-backdrop modal fade" id="basicModal" style="display: none;" data-backdrop="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="myModalLabel">Update Display Picture</h4>
      </div>
      <div class="modal-body col-xs-12">
       <div class="col-xs-4">
        <a href="#" class="btn btn-lg btn-success text-center" style=" margin-top:50%;width:150px; height:50px;"><i class="glyphicon glyphicon-plus"></i> Upload a photo</a>
        </div>

       <div class="col-xs-8">
       <h4 class="pull-right">PREVIEW</h4>
         <div class="center-block" style="background-image:url(img/default-picture.jpg);
            width: 200px;
             height: 200px;
             background-size: cover;
             display: block;
             border-radius: 100px;
             -webkit-border-radius: 100px;
             -moz-border-radius: 100px;">
         </div>
       </div>
      </div>
      <div class="modal-footer">
        <br>
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>

</div>  
Run Code Online (Sandbox Code Playgroud)

Sur*_*lai 6

覆盖该模式的默认不透明度:

.modal-backdrop, 
.modal-backdrop.fade.in{
opacity: 1;
filter: alpha(opacity=100);
background: #fff;
}
Run Code Online (Sandbox Code Playgroud)

如果上述方法不起作用,请尝试使用!important关键字:

.modal-backdrop, 
.modal-backdrop.fade.in{
opacity: 1 !important;
filter: alpha(opacity=100) !important;
background: #fff;
}
Run Code Online (Sandbox Code Playgroud)