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

HTML Introduction to HTML and CSS (2016) Adding a New Web Page Write the CSS

Daniel Nease
Daniel Nease
2,838 Points

Trouble linking CSS file to HTML

<!DOCTYPE html>
 <html>
  <head>
    <title>Daniel Nease Resume</title>
    <link ref="stylesheet" href="res.css">
  </head>
  <body>
    <img src="https://picsum.photos/200" alt="Daniel Nease, Web Developer">
    <h1>Daniel Nease, Web Developer</h1>
    <h2>Summary of Qualifications</h2>
    <ul>
      <li>Experience as a WB</li>
      <li>Experience with HTML</li>
      <li>No BS degree</li>
    </ul>
  </body>
</html> 
h1{
  color: blue;
  }
Daniel Nease
Daniel Nease
2,838 Points

all the files are in the same folder fyi and all are labeled correctly.

To format your code better, try wrapping your code with three backticks. at the end of the first set of backticks, type 'html', like this:

//Write code here

The problem is you have your stylesheet as a ref when it should be a rel, your code should look like this

<link rel="stylesheet"..../>

1 Answer

Matthew Lang
Matthew Lang
13,483 Points

The link tag takes many attributes, however the most important are these 3:

  • rel
  • href
  • type

The rel attribute should specify the relationship between the current document and the linked document. In this case, it's a 'stylesheet', which you have in your code, however you have specified it as a 'ref'. Maybe you mistyped.

It should be:

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