Html Bootstrap 3 模式显示透明背景

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26192783/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 02:49:37  来源:igfitidea点击:

Bootstrap 3 modal shows a transparent background

htmltwitter-bootstrap-3

提问by Saeed Mousavi

I created a simple HTML with bootstrap 3.2 :

我用 bootstrap 3.2 创建了一个简单的 HTML:

<body>
    <div>
        <a class="btn" href="#frmLogin" data-toggle="modal">login</a>
    </div>

    <div class="modal fade" id="frmLogin" role="dialog">
        <div class="modal-dialog">
            <div class="modal-content>">
                <div class="modal-header">
                    <a class="btn" data-dismiss="modal">×</a>
                    <h3 id="modalTitle">Login</h3>
                </div>

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

but the modal does not show correctly.

但模态显示不正确。

fiddle link : http://jsfiddle.net/jsmLxhv9/1/

小提琴链接:http: //jsfiddle.net/jsmLxhv9/1/

采纳答案by Harutyun Abgaryan

<body>
  <!-- Button trigger modal -->
<button class="btn" data-toggle="modal" data-target="#myModal">
  Login
</button>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <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>
</div>
</body>

回答by jeffproe

I'm a little late to the party here, but I had the same issue, which lead me to this post. The issue with the posted code is that

我参加聚会有点晚了,但我遇到了同样的问题,这使我找到了这篇文章。发布的代码的问题是

<div class="modal-content>">

needs to be

需要是

<div class="modal-content">

Other than that, it works fine. Check it out here: http://jsfiddle.net/hjqo17dq/

除此之外,它工作正常。在这里查看:http: //jsfiddle.net/hjqo17dq/