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
sour grapes
5,389 PointsStyles 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
Robert Komaromi
11,927 PointsIt would help a lot if you posted your code, but here are some things you can try:
- Make sure you include your
style.cssfile AFTER yourbootstrap.min.cssfile, otherwise styles defined inbootstrap.min.cssmay override your custom styles instyle.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.cssfile 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 yourindex.htmlfile at/and yourstyle.cssfile at/css, then you should link your CSS file like so:
<link rel="stylesheet" type="text/css" href="css/style.css">
- Ensure you are writing valid CSS code. You can check your CSS with a validator like jigsaw.w3.org/css-validator
Richmond Lauman
28,793 PointsI 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?
sour grapes
5,389 PointsThanks a lot
I used the css-validator and found an error in my style.css. Used a semicolon where i shouldn't
Robert Komaromi
11,927 PointsI'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.