DMXzone Bootstrap 3 Support Product Page

Answered

Centre container

Asked 17 Jun 2014 11:47:10
1
has this question
17 Jun 2014 11:47:10 David Woolley posted:
What is the best way of centering the content on the page if there are 2 Bootstrap containers, say one for the navbar, then the other for the main content?
I need to limit the maximum width as well to something like in this example:
getbootstrap.com/examples/jumbotron-narrow/

Would you wrap the 2 containers in an outer div with a class:
margin: 0 auto;
max-width: 800px;

Or would it be better to put the navbar & content in one Bootstrap container then add the code above to the .container-fluid class in a separate css file?

Still trying to get my head around Bootstrap 3

Cheers
Dave

Replies

Replied 17 Jun 2014 12:10:02
17 Jun 2014 12:10:02 Teodor Kuduschiev replied:
If you want to use the .container or .container-fluid classes with a different than the standard width you can do the following.
1. Add a custom class to it, for example: <div class="container-fluid container-narrow"....
2. Style this class using CSS, as you normally do for any other element on your page: .container-narrow { max-width:800px; }
That's all.
Replied 17 Jun 2014 12:21:45
17 Jun 2014 12:21:45 David Woolley replied:
Thanks Teodor - and to centre the container I would include:
margin: 0 auto;
in the container-narrow class
Or is that already taken care of in the main bootstrap.css ?
Cheers
Dave
Replied 17 Jun 2014 12:25:54
17 Jun 2014 12:25:54 Teodor Kuduschiev replied:
You do not need to add anything else in order to center the container. This is already done in the bootstrap css file.
Replied 17 Jun 2014 13:27:41
17 Jun 2014 13:27:41 David Woolley replied:
Thanks Teodor

Reply to this topic