How to choose the container 960px wide and not to 1200px in Bootstrap
Asked Answered
G

5

6

How to choose the container 960px wide and not to 1200px in Bootstrap?

Goaltender answered 20/12, 2012 at 20:6 Comment(1)
Are you using bootstrap 2 or bootstrap 3?Etienne
I
5

Do you just want a fixed width website? If so then then just don't include bootstrap-responsive.css. The default width for a fixed width container will be 960px.

Otherwise if you still want the responsive features but no 1200px container you will need to customize your bootstrap install. To do that:

Incoercible answered 20/12, 2012 at 20:14 Comment(4)
I did not understand, because if I customize the download as you say, I do not download the document bootsrap responsive. It 's normal?Goaltender
yeah. its fine. the responsive parts are added to the bootstrap.css and bootstrap.min.css files. If you replace all these files with all the old files you had, you should get your desired result.Incoercible
You are very kind to explain to me, but apparently it does not work :) I substitute the file I downloaded bootsrap and in fact the container is resized to 960px But the site is no longer responsive thanks againGoaltender
that is weird....... Another option is have your old files and just remove everything contained in @media (min-width: 1200px) from the bootstrap and bootstrap-responsive css files I hadn't tried the customize bootstrap thing myself and assumed it would work fine.. but i guess not.Incoercible
S
9

Bootstrap sets container width to 1170px on screens wider than 1200px.
For screens from 992px to 1200px width of container is set to 970px. You can read more about bootstrap's grid here
Now if you want to set container to 760px for large screens, you have to locate this and edit in bootstrap.css or add this code to your custom css:

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

and

@media (min-width: 992px) {
  .container {
    width: 960px;
   }
 }

Hope this helps

Seclude answered 21/11, 2013 at 22:31 Comment(0)
I
5

Do you just want a fixed width website? If so then then just don't include bootstrap-responsive.css. The default width for a fixed width container will be 960px.

Otherwise if you still want the responsive features but no 1200px container you will need to customize your bootstrap install. To do that:

Incoercible answered 20/12, 2012 at 20:14 Comment(4)
I did not understand, because if I customize the download as you say, I do not download the document bootsrap responsive. It 's normal?Goaltender
yeah. its fine. the responsive parts are added to the bootstrap.css and bootstrap.min.css files. If you replace all these files with all the old files you had, you should get your desired result.Incoercible
You are very kind to explain to me, but apparently it does not work :) I substitute the file I downloaded bootsrap and in fact the container is resized to 960px But the site is no longer responsive thanks againGoaltender
that is weird....... Another option is have your old files and just remove everything contained in @media (min-width: 1200px) from the bootstrap and bootstrap-responsive css files I hadn't tried the customize bootstrap thing myself and assumed it would work fine.. but i guess not.Incoercible
S
1

This works for me.

!important is not recommended to use. but you can try.

.container, .container-fluid{
 width: 960px !important;
}
Shambles answered 21/12, 2012 at 5:24 Comment(0)
P
0

For Bootstrap3, you can customize it to get 960px by default (http://getbootstrap.com/customize/)

  1. change @container-lg from ((1140px + @grid-gutter-width)) to ((940px + @grid-gutter-width)).
  2. change @grid-gutter-width from 30px to 20px.

then download your custom version of bootstrap and use it. It should be 960px by default now.

Promotion answered 14/1, 2014 at 6:37 Comment(0)
C
0

If you are using sass and bootstrap v3.3.1, just define these variable before importing bootstrap:

$grid-gutter-width: 20px;
$container-large-desktop: 940px + $grid-gutter-width;

For more info please check the variables source file: https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/bootstrap/_variables.scss

Charlettecharley answered 15/1, 2015 at 10:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.