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

Styles from style.css do not get applied to my site

My style.css is loaded in the header but the style do not get applied to the page. Only styles from bootstrap.min.css get applied to my page.

Nay help?

3 Answers

It would help a lot if you posted your code, but here are some things you can try:

  • Make sure you include your style.css file AFTER your bootstrap.min.css file, otherwise styles defined in bootstrap.min.css may override your custom styles in style.css.

Example:

<link rel="stylesheet" type="text/css" href="bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="style.css">
  • Double check the path to your style.css file and make sure you don't have any typos in your file path or file name. Your HTML page is looking for the CSS files relative to itself. So if you have your index.html file at / and your style.css file at /css, then you should link your CSS file like so:
<link rel="stylesheet" type="text/css" href="css/style.css">

I am guessing it has to do with how you are linking to the stylesheet in your html head. Can you post the HTML for the page?

Thanks a lot

I used the css-validator and found an error in my style.css. Used a semicolon where i shouldn't

I'm glad you got it figured out! I know I used to put semi-colons after my CSS rules like this:

.my-div { color: red; };

And then all the CSS after that would not be applied.