Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML

Sam Donald
Sam Donald
36,305 Points

css html linking issue!!

Hi guys, I know there have many discussions on this before but I haven't been able to find an answer that works for me.

I'm trying upload a screen shot of my problem but can't get the Markdown to work! :{ SEE BELOW

Sam Donald
Sam Donald
36,305 Points

Both my index.html and style.css are contained within the same directory. I tried running it in Safari and Chrome both up to date. The css is not listed in the resources section of the Developers tools in Chrome.

Here's my code, thanks.

<!DOCTYPE HTML> 
<html> 
    <head> 
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <title>FreshStart</title> 
        <link ref="stylesheet" href="css/style.css" type="text/css" media="screen">
    </head>
    <body> 
        <ul class="nav"> 
            <li><a href="#">home</a></li> 
            <li><a href="#">about</a></li>
            <li><a href="#">downloads</a></li>
            <li><a href="#">making change</a></li>
            <li><a href="#">partners</a></li>
            <li class="last"><a href="#">contact us</a></li>
        </ul>
    </body>
</html>

2 Answers

Elliott Frazier
PLUS
Elliott Frazier
Courses Plus Student 9,647 Points

You don't need to add css/ to the beginning of your file path because that tells the browser to look in a folder called "css" for "style.css".

You put <link ref="">

I do believe it should be <link rel="">

Using a lower case L rather than an F

Also - when linking to a file that's in the same directory, the /css folder is not required. It should just be <link rel="stylesheet" href="style.css" type="text/css" media="screen">

Sam Donald
Sam Donald
36,305 Points

ref? Now thats embarrassing......

Thanks Conner Kuehl that seems to have been the problem.

my href was correct though because while they are both in the same main directory, my css is in a subdirectory of index.html. But thanks all the same :)