2014-02-26 54 views
-1

我是新手,使用Bootstrap 3。我做了一個容器12列與width: 960px;。然後我注意到容器大小改爲width: 1110px。誰能告訴我問題是什麼?我只想要一個寬度爲960px的固定容器;bootstrap 3容器大小

請檢查here

我找到的CSS:

.col-lg-12 { 
    margin-left: 0; 
    min-height: 1px; 
    padding-left: 15px; 
    padding-right: 15px; 
    position: relative; 
} 
+0

[Bootstrap:如何更改容器的寬度?](http://stackoverflow.com/questions/15884102/bootstrap-how-do-i-change-the-寬度的容器) –

+0

閱讀關於它[這裏](http://getbootstrap.com/getting-started/#disable-responsive)。看看這個例子[這裏](http://getbootstrap.com/examples/non-responsive/)。得到你所有的CSS [這裏](http://getbootstrap.com/examples/non-responsive/non-responsive.css) – slynagh

+0

@Mohamed Samy你是否在這些** Sass **或** LESS **? – Muhammed

回答

0

從bootstrap.css

.container { 
    margin-right: auto; 
    margin-left: auto; 
    padding-left: 6px; 
    padding-right: 6px; } 
    .container:before, .container:after { 
    content: " "; 
    display: table; } 
    .container:after { 
    clear: both; } 
    @media (min-width: 768px) { 
    .container { 
     width: 732px; } } 
    @media (min-width: 992px) { 
    .container { 
     width: 952px; } } 
    @media (min-width: 1200px) { 
    .container { 
     width: 1152px; } } 

修改這個CSS屬性中刪除

@media (min-width: 1200px) { 
    .container { 
     width: 1152px; } 

更新

@media (min-width: 990px) { 
    .container { 
     width: 950px; } } 

請在下面評論,如果任何錯誤,而使用這個代碼

+0

以上代碼在引導程序中不存在3.1 – HenryW

+0

@HenryW哪個代碼? – Muhammed

+0

'.container {margin} - right:auto; margin-left:auto; padding-left:6px; padding-right:6px; } 。容器:之前,.container:之後{ 內容:「」; display:table; } 。容器:在{ 明確:兩者; } @media(min-width:768px){ .container { width:732px; }} @media(min-width:992px){ .container { width:952px; }} @media(min-width:1200px){ 。容器{寬度:1152px; }}' – HenryW

0

值得注意的是:如果你正在使用青菜與引導,改變容器的大小就像改變一個變量一樣簡單。在引導3(3.3.5確切地說)在variables.less文件看起來像這樣的容器設置:

//== Container sizes 
// 
//## Define the maximum width of `.container` for different screen sizes. 

// Small screen/tablet 
@container-tablet:    (720px + @grid-gutter-width); 
//** For `@screen-sm-min` and up. 
@container-sm:     @container-tablet; 

// Medium screen/desktop 
@container-desktop:   (940px + @grid-gutter-width); 
//** For `@screen-md-min` and up. 
@container-md:     @container-desktop; 

// Large screen/wide desktop 
@container-large-desktop:  (1140px + @grid-gutter-width); 
//** For `@screen-lg-min` and up. 
@container-lg:     @container-large-desktop; 

(見bootstrap's github repo

所以適應的.container大小爲大屏幕,簡單地覆蓋通過將其添加到您自己的variables.less -file變量@container-large-desktop

@container-large-desktop: ((930px + @grid-gutter-width)); 

@grid-gutter-witdh設置爲30px在默認情況下,因此以上會導致有一個960像素的容器)