Bootstrap简单模板:将模态放置在屏幕中间

时间:2014-05-08 03:17:23

标签: asp.net-mvc modal-dialog twitter-bootstrap-3

当我使用http://getbootstrap.com/javascript/#modals给出的样本打开模态时。

<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
    Launch demo modal
</button>        

<div class="modal" 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" aria-hidden="true">×</button>
                <h4 class="modal-title">Modal title</h4>
            </div>
            <div class="modal-body">
                <p>One fine body…</p>
            </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>

使用默认模板工作正常,但在加载Simplex模板(http://bootswatch.com/simplex/)时它停止正常工作。

bundles.Add(new StyleBundle("~/Content/css").Include(
                  "~/Content/bootstrap.css",
                  "~/Content/site.css",
                  "~/Content/simplex.css"));

单击按钮后添加simplex.css后,模式出现在屏幕的最右侧。 (它甚至可以扩展我的窗口x轴)

enter image description here

如何调整模态以使其在屏幕中间正确显示?谢谢!

1 个答案:

答案 0 :(得分:0)

我正在加载原始的bootstrap.css + simplex模板,而不是只加载simplex模板。

bundles.Add(new StyleBundle("~/Content/css").Include(
              "~/Content/site.css",
              "~/Content/simplex.css"));

我刚删除它,它现在完全正常工作。谢谢!