twitter-bootstrap 未应用 Bootstrap 3.1.0 模态大小调整

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21503578/
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-10-21 19:55:05  来源:igfitidea点击:

Bootstrap 3.1.0 modal sizing not applied

twitter-bootstraptwitter-bootstrap-3bootstrap-sass

提问by Jonathan Bender

After updating my bootstrap-sassgem to 3.1.0to take advantage of the new sizing options on modals (.modal-lgand .modal-sm), I've been unable to get the styling to be applied. My code is as follows:

更新我的bootstrap-sassgem 以3.1.0利用模式(.modal-lg.modal-sm)上的新大小选项后,我一直无法应用样式。我的代码如下:

<div aria-hidden="false" aria-labeldby="ccModalLabel" class="modal fade in" id="ccModal" role="dialog" style="display: block;">
  <div class="modal-dialog modal-sm">
    ...content...
  </div>
</div>

Which, as far as I can tell, is nearly identical to the examplein all the attributes that matter:

据我所知,在所有重要的属性上几乎与示例相同:

<div class="modal fade bs-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-sm">
    <div class="modal-content">
      ...
    </div>
  </div>
</div>

However, upon inspection, the modal-smclass isn't been evaluated in my code as it is in the example, leading me to think that maybe it isn't included in the gem somehow, or am I missing something? The modal works in every other way aside the sizing.

但是,经过检查,modal-sm我的代码中没有像示例中那样评估该类,这让我认为它可能没有以某种方式包含在 gem 中,或者我是否遗漏了什么?除了大小之外,模态以其他方式工作。

采纳答案by Design by Adrian

Try latest Bootstrap - version 3.1.1

尝试最新的 Bootstrap - 3.1.1 版

BootstrapBootstrap SASS

Bootstrap Bootstrap SASS

回答by jokab

I cannot simply update my bootstrap because of some breaking changes so what i did was added this to my site.css

由于一些重大更改,我不能简单地更新我的引导程序,所以我所做的将它添加到了我的 site.css

@media screen and (min-width: 768px) {
  .modal-lg{
      width:900px;
  }

  .modal-sm{
      width:300px;
  }
}

I hope this helps someone else.

我希望这对其他人有帮助。

回答by Ivo

You need to set $modal-lg with the desired width before your import bootstrap:

您需要在导入引导程序之前将 $modal-lg 设置为所需的宽度:

$modal-lg: 900px;
@import "bootsrap";

The default is 900px.

默认值为 900 像素。