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 isn't linking to my HTML

Hello, Curious as to why my css won't link to my html. I am using the files from the lesson.

here is my code

* {
    margin: 0;
    padding: 0;
    color: red;

here is my html

<!DOCTYPE html>
    <title>CSS Selectors</title>
    <link rel="stylesheet" type="text/css" href="style.css">
    <h1>Learning About <span>CSS Selectors</span></h1>
        <span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam quis tristique magna.</span> Phasellus sapien mauris, aliquet quis ullamcorper nec, vestibulum eu tortor. Duis id venenatis augue. Suspendisse mauris eros, hendrerit vitae posuere nec, aliquet eget magna. Vivamus quis nunc non ipsum imperdiet pharetra id ac metus. Vestibulum aliquet eu velit in pulvinar. Donec feugiat quam leo, vel pulvinar quam pellentesque pretium.
    <h2>Selectors Match <span>HTML Elements</span></h2>
        Vestibulum malesuada, orci id consectetur congue, justo augue porta lorem, at varius turpis mauris sit amet est. Ut vulputate dictum vestibulum. <span>Integer at vestibulum lacus</span>, venenatis auctor diam. Duis luctus, leo at ultrices placerat, est ante placerat leo, vitae tempor lorem augue a sem. Tiam vitae porta libero. Proin ac eros non lacus scelerisque elementum. Integer vulputate enim non eros tincidunt, sed laoreet sapien.
        Pellentesque posuere risus a purus auctor sagittis. Quisque lorem ligula, imperdiet vel faucibus vitae, mollis at leo. Proin ac commodo odio, sed tempor nibh. Nunc vel mauris in quam ultrices ornare. Aenean sagittis eget magna ut sodales.

I have tried all different paths to my href

3 Answers

For starters you put the opening backticks in the subject line.

We can't see any code.

But I'll take a shot at solving the problem without seeing the code.

Do you have your stylesheet linked correctly?

For instance if your css file was called style.css you should be calling that file like this in your html

<link href="style.css" rel="stylesheet" type="text/css">

Make sure it is in your <head> tags and your pointing it to the correct name of your css file and that the css file is in the same folder as your html file.

i can make a difference to what u have posted. it looks like a bunch of words together...there are no html tags as well. can u please paste again only your markup without any other text...

evidently the


property in treehouse forum doesn't work with pasting from sublime text.

James Barnett
James Barnett
39,199 Points

You need a blank line between the text and the backtick.