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

CSS doesnt seem to work on index.html

Hi, I am new to coding and just setting up my first index.html and CSS sheet in workspace. For some reason, no matter how correct i type my CSS and use class, it has no effect on HTML?

I know this is a basic question but do I need to name the CSS sheet for it to have effect on the index.HTML? I have tried everything and nothing seems to work!!

3 Answers

Rick Gleitz
Rick Gleitz
47,522 Points

Hi Ian,

If you have your CSS in a separate file, make sure its name is style.css. Inside the <head> tags in your .html file, put <link rel="stylesheet" href="style.css"> This is if both files are in the same folder, if not, then you need to put the file path in front of style.css in the href.

You can name your styles file a different name as long as you change the name in the href too (but it must end in .css)

Hope this helps.

Thanks Rick, this seemed to work as I had to change a certian error round.

Also thanks Gerlin. Seems I was typing in Uk English not American English. Thanks both for the help!!

Hi,

Thanks for your response. I have tried this and still nothing?

This is the opening text I have in the start of my index.html. I have even tried to add background colour directly into the index.html iteslf and it still doe snot change naything?

<!doctype html> <html lang="en"> <head> <title>Ian Simpson Profile</title> <link rel="stylesheet" href="style.css"> </head>

<body style="background-colour: orange;">
<header>

I am obviously doing something wrong as the guide I have been watching allows me to change anything within the CCS but my project doesnt seem to let me?

Any help with this would be most apreciated as its part of a challenge I am doing and I need to complete the project soon and without this, I am not getting anywhere!!

with thanks Ian