Reputation: 45
I'm new to coding so sorry if this seems like an obvious question.
When using bootstrap 1) can I have more than 1 container? if so how do I go about styling them separately if they both have to be called container ?
Thanks!
Upvotes: 3
Views: 82
Reputation: 362780
Yes, you can have as many container
or container-fluid
as needed.
Add a custom CSS class to the containers to stylize..
<div class="container-fluid">...</div>
<div class="container-fluid someclass">...</div>
.someclass {
background-color:#eee;
}
http://www.codeply.com/go/8vDhaX4kKV
Upvotes: 2
Reputation: 26444
The Bootstrap website says this
Easily center a page's contents by wrapping its contents in a .container. Containers set width at various media query breakpoints to match our grid system.
Note that, due to padding and fixed widths, containers are not nestable by default.
You can have multiple containers, but you should not nest them.
Now assuming you do have more than one, there are multiple ways you could style them.
<div class="container" id="container1">
. You can then reference this with the id selector (#container1
).container:first-of-type
, .container:nth-child(3)
etcUpvotes: 1