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

linking css to html

i am not able to link css to html file. What can be possible reasons? console log shows that its is unable to find css file,though i have linked my css file correctly,

<link rel="stylsheet"href="css/normalize.css"> <link rel="stylesheet" href="css/main.css">

2 Answers

Linking a CSS file consists of 3 parts:

<link rel="stylesheet" type="text/css" href="style.css">
  • The rel attribute specifies the relation of the current document to the linked one.
  • The type attribute specifies the type of file which is linked.
  • href points to the file.

You have forgotten to mention the type. But I don't think this is what causes the issue here, can you share your code with us?

https://teamtreehouse.com/workspaces/28777092

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>PRATIK TALREJA|DEVELOPER</title> <link rel="stylsheet"href="css/normalize.css"> <link href="https://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=PT+Sans|Raleway" rel="stylesheet"> <link rel="stylesheet" href="css/main.css"> </head> <body> <header> <a href="index.html" id="logo"> <h1>Pratik Talreja</h1> <h2>Developer</h2> </a> </header> <nav> <ul > <li><a href="index.html" class="selected">Portflio</a></li> <li><a href="about.html">About</a></li> <li><a href="contact.html">Contact</a></li> </ul> </nav> <p></p> <ul id="content"><li> <p>Hello.I am Pratik Talreja. This is my first attempt of making a website on my own.In this webpage you will get to see some of my pictures and my contact links.

 </p></li></ul>

<section><ul id="gallery">

  <li><p><img src="IMG_9272.JPG"alt"4"></p></li>
  <li><p><img src="1238315_513659205392647_1670475933_n.jpg"alt"1"></p></li>



  <li><p><img src="13781818_1066490913442804_8804971973729512311_nmbcopy.jpg"alt"2"></p></li>
  <li><p><img src="287A8309.jpg"alt"3"></p></li> 


  <li><p><img src="287A8818.jpg"alt"7"></p></li>
  <li><p><img src="IMG_9348.JPG"alt"4"></p></li>

  <li><p><img src="13775994_1066490753442820_2672948692385461414_ncopy.jpg"alt"5"></p></li>
  <li> <p><img src="19467745_1407289289362963_6933517857255565280_o (1)copy.jpg" alt"6"></p></li>
  </ul>






</section>

<footer id="f"> <ul>
<li><p><a href="https://www.facebook.com/pratik.talreja.3"><img src="facebook.png" alt"facebook-logo"></a></p></li>

<li><p><a href="https://www.instagram.com/talreja_pratik/"><img src="insta.png" alt"instagram-logo"></a></p></li> <p>©2017|PratikTalreja</p>

</ul>
</footer> 

</body> </html>

I can't open the workspace link you posted (page does not exist) :/

But the HTML looks fine, so problem isn't there.

Have you tried putting something like:

*{
    color : red;
}

in your css code to see if it is linked?