Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS Bootstrap Basics Building Forms With Bootstrap Add Custom CSS to Your Bootstrap Site

Creating rules in custom.css

Hi, I was wondering when create a rule in our own custom css that has the same class/element name as one given to us by bootstrap. Does it override the one created by bootstrap completely, or does it only override the properties that we have both written? Sorry if the question is a little confusing.

2 Answers

Adam Pengh
Adam Pengh
29,881 Points

It would only overwrite the properties that you are setting.

/* 
 * Bootstrap CSS 
 */
.container {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

/* 
 * Custom CSS 
 * Will only modify the padding-right and padding-left properties
 * width, margin-right, and margin-left would remain the same.
 */
.container {
    padding-right: 10px;
    padding-left: 10px:
}

Thank you very much :)

Fran ADP
Fran ADP
6,304 Points

.container { width: 100%; padding-right: 15px; padding-left: 15px; margin-right: auto; margin-left: auto; }

.container { padding-right: 10px; padding-left: 10px: }