twitter-bootstrap Twitter 引导程序 - 更改默认宽度
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13126614/
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
Twitter bootstrap - changing default width
提问by neridaj
I'm just geting started with twitter bootstrap and wanted to know what the best approach for changing the default width from 940px to 864px is. I tried using the customize page to change the @gridColumnWidth variable to 50px. which should make the total width 820px but the default width is just adjusted to 1170px after downloading. Should I just leave the default at 940px and nest a div with a width of 864px inside my .row>.span12 divs?
我刚刚开始使用 twitter bootstrap,想知道将默认宽度从 940px 更改为 864px 的最佳方法是什么。我尝试使用自定义页面将 @gridColumnWidth 变量更改为 50px。这应该使总宽度为 820 像素,但下载后默认宽度仅调整为 1170 像素。我应该保留默认值 940px 并在我的 .row>.span12 div 中嵌套一个宽度为 864px 的 div 吗?
I also tried using the less files but when I try to compile them as css files I get errors that say classes, id's, and variable are undefined.
我也尝试使用 less 文件,但是当我尝试将它们编译为 css 文件时,我收到错误消息,指出类、id 和变量未定义。
Thanks for any help,
谢谢你的帮助,
Jason
杰森
回答by Sara
It's working fine for me using the customize page.
使用自定义页面对我来说效果很好。
Make sure to modify @gridColumnWidth, @gridColumnWidth1200, and @gridColumnWidth768(and optionally @gridGutterWidth*).
The 1170px width you're seeing corresponds to @gridColumnWidth1200.
确保修改@gridColumnWidth、@gridColumnWidth1200和@gridColumnWidth768(以及可选的@gridGutterWidth*)。
您看到的 1170px 宽度对应于@gridColumnWidth1200.
回答by Matt Whipple
You can override the default styles by placing another CSS file with the same selectors and desired formatting after bootstrap.css. Optionally you can also just use selectors with higher specificity and then the order of the files will be irrelevant. Using !importantshould be a last resort as it complicates further use.
您可以通过在 .css 之后放置具有相同选择器和所需格式的另一个 CSS 文件来覆盖默认样式bootstrap.css。或者,您也可以只使用具有更高特异性的选择器,然后文件的顺序将无关紧要。使用!important应该是最后的手段,因为它使进一步使用复杂化。

