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 Foundations Getting Started with CSS Adding CSS to a Page

My html doc is not linking with my css page. I've tried everything and reviewed every step from the video.

I'm using windows 8.1 and the NotePad text editor. Can someone please tell me why this is not linking properly?

Andrew McCormick
Andrew McCormick
17,730 Points

as stated. We need to see your code. Please see How to post code to forum

8 Answers

What's your code (are you using relative link etc) and what's your folder structure? Are you saving the files as .html and .css respectively?

Here is the code I am using:

<!DOCTYPE html>
<head> 
    <title>Adding CSS</title>
    <link rel="stylesheet" href="CSS/style.css">
    <style type="text/css">
        h1 {
            color:white;
            background-color: #E14607;
         }
     </style>
  </head>
 <body style="background-color: #BDD4DE;">
       <h1>Adding CSS to the Page</h1>
       <p style="font-weight: bold;">Lorem to susa to romani do opui fjg djdddjd kkksks eettss dddmnd,  dfgbdbgd
        fgdbgdhbgmdfbgmdfbgmdbgdfmbgdmbgdmfbgdmbgmdbfmdmfbgmfdgbmdfgbdmfgdmnd  ddggdmgbdgdm
        dfngdfngd  dfgdbgmdbfgmdfgkd,gdnfg,dn  ,gnd,nm,dngmdnfgdg,dfhss   smbgsnsnf,msfs
        sbfsf,mdnfmsdfmsn,snfmdnsfs dmfs  sdfb,snfmsdnmns,  sfn,sn,sdnfsn,fnd  sdfn,sf,s</p>
       <p> hjxbfbsj snfbsndfbsd  sbfksbfdjsbf  sjdfskjbfksbf  ksjfksjfkjsd sdfksnfksjfdk
           dfbgdbgdfgmdgdfmgndf,ngdfngdmf  jfhkgjsfkskjflksjffs shfslkjflksjddlj  sldjflslsjfjslkjf
           skfnksdnflsndfsl  slkdjlskdksjljfsl  lksjglsjdklsjls  slkjfslkjlksjdk klsjflsjdlfksj 
           djfnsflksdn  slkfjlksjdklfsdjlsd  lksjdfljlsjlkfjd  sjlkdjkdh  lskjflksjklfsjk slk</p>
       <h2>Lorem ipsum dolor sit amet</h2>
       <ul>
           <li>Praesent sem ligula rhoncus</li>
           <li>Dones ut ipsum at quam</li>
           <li>Maecenas libero neque accumsan ut</li>
           <li>Donec quis mauris ipsum</li>
      </ul>
  </body>
</html>

I don't understand why this is not working. I used the right code to link my html and css pages and followed the instructions thoroughly. I hope the code in this comment fits properly for you to understand.I apologize for any inconvenience.

What's your CSS code and what are you expecting to change ? You've got at least two places in your HTML that would override the styles you imported, depending on what you're styling in your css file.

Tiffany McAllister
Tiffany McAllister
25,806 Points

I would suggest using something other than the default Windows Notepad as it does not have any syntax highlighting and makes it very difficult to see errors in your code. I would use something like NotePad++, Sublime or Brackets.

Do you have to pay for the Sublime or Brackets text editors ?

Nick Karastogiannis Brackets is free and open source (http://brackets.io/), Sublime is paid for (http://www.sublimetext.com/)

Will windows 8.1 have the text editors that you mentioned ?

You will need to download Notepad++ (http://notepad-plus-plus.org/), Sublime is very excellent and what I use but you have to pay for it.

As Tiffany said you really need the syntax highlighting to make it more obvious and you didn't say whether you definitely saved the files as .html and .css. Again syntax highlighting would confirm that or whether you'd saved them as text files.

It's not easy to see from what you posted as you need to use the forum formatting for HTML code. Please post the code as per the link that Andrew McCormick gave you. Use (```) around the code before and after, and "HTML" after the first set of ticks.

Hi Nick Karastogiannis, have you placed a "link" markup within the "head" markup that shows your CSS file path? If that does not work, other things might be causing your problem.

Yes, I've even included the rel and hreference.

Nick Karastogiannis we still need to see your actual formatted code to make sure. Use the markdown instructions already posted.

I tried to post the code in my comments but it wont show up at all. By the way, I downloaded the "Bracket" text editor.

Did you read the instructions for posting code, the very first comment gave you a link? https://teamtreehouse.com/forum/posting-code-to-the-forum

Just put three ticks ``` in front of the code and "html" after those three ticks then three ticks at the end.

Thank you for your patients and help. The code I wrote is: <link rel="stylesheet" href="CSS/style.css">

Is your style.css files inside a folder called "CSS" all caps? Could we see the entire HTML code you have?

sure:

 <!DOCTYPE html>
<head> 
    <title>Adding CSS</title>
    <link rel="stylesheet" href="CSS/style.css">
    <style type="text/css">
        h1 {
            color:white;
            background-color: #E14607;
         }
     </style>
  </head>
 <body style="background-color: #BDD4DE;">
       <h1>Adding CSS to the Page</h1>
       <p style="font-weight: bold;">Lorem to susa to romani do opui fjg djdddjd kkksks eettss dddmnd,  dfgbdbgd
        fgdbgdhbgmdfbgmdfbgmdbgdfmbgdmbgdmfbgdmbgmdbfmdmfbgmfdgbmdfgbdmfgdmnd  ddggdmgbdgdm
        dfngdfngd  dfgdbgmdbfgmdfgkd,gdnfg,dn  ,gnd,nm,dngmdnfgdg,dfhss   smbgsnsnf,msfs
        sbfsf,mdnfmsdfmsn,snfmdnsfs dmfs  sdfb,snfmsdnmns,  sfn,sn,sdnfsn,fnd  sdfn,sf,s</p>
       <p> hjxbfbsj snfbsndfbsd  sbfksbfdjsbf  sjdfskjbfksbf  ksjfksjfkjsd sdfksnfksjfdk
           dfbgdbgdfgmdgdfmgndf,ngdfngdmf  jfhkgjsfkskjflksjffs shfslkjflksjddlj  sldjflslsjfjslkjf
           skfnksdnflsndfsl  slkdjlskdksjljfsl  lksjglsjdklsjls  slkjfslkjlksjdk klsjflsjdlfksj 
           djfnsflksdn  slkfjlksjdklfsdjlsd  lksjdfljlsjlkfjd  sjlkdjkdh  lskjflksjklfsjk slk</p>
       <h2>Lorem ipsum dolor sit amet</h2>
       <ul>
           <li>Praesent sem ligula rhoncus</li>
           <li>Dones ut ipsum at quam</li>
           <li>Maecenas libero neque accumsan ut</li>
           <li>Donec quis mauris ipsum</li>
      </ul>
  </body>
</html>
Tiffany McAllister
Tiffany McAllister
25,806 Points

Do you have a folder called CSS with style.css inside?

yes I did, that's one of the first things I did.

In the beginning, I opened up my html document with a Google Chrome web browser. Do you think that is my problem?