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

Im having trouble getting css to link to HTML

My CSS isn't linking to my HTML properly. I need to know what I'm doing wrong for this to be a problem, or if it's just me.

<doctype html> <html> <head> <title>river photos</title> <link href="/river2.css type=text/css" rel="stylesheet"> </head> <body> <h1> Pictures of trhe river</h1> <h2> These are a few pictures that I took over the river several years ago.</h2> <img src="riversunset.jpg" alt="two bridges over Ohio River" class="main-image"> <h3>More pictures coming soon.</h3> </body> </html> This is the code for the HTML. I just wanted to start small, but then start going and getting bigger ideas. so Even the stylesheet itself is small.

h1 { color: orange; }

.main-image { border: solid black 25px; border-radius: 25%; }

3 Answers

Actually it wasn't any coding error that I had done. I got to looking because I had done some other learning with html, and css in the past, and so I knew that that particular stylesheet was linked up to it's html page. When I went to make some changes in it to see if I could play around with it. I had the same problem. Nothing worked. So I knew then it wasn't my imagination. I restarted the computer, and let it do its updates, and now things work fine. I guess that turning this silly thing off sometimes would help wouldn't it.

Steven Parker
Steven Parker
231,248 Points

Always remember to save any editor changes with the menu or Ctrl-S shortcut and then refresh the browser to update your preview. But of course "if all else fails, reboot'. :wink:

Steven Parker
Steven Parker
231,248 Points

It looks like you're missing some quote marks:

 <link href="/river2.css type=text/css" rel="stylesheet">    <!-- original -->
 <link href="/river2.css" type="text/css" rel="stylesheet">  <!-- fixed -->

Also, be sure you really intended to use an absolute path reference. Perhaps "river2.css" would do, or if the file is in a "css" folder, you might need "css/river2.css".

I did change that like you said, and for some reason it's still not linking up.

Steven Parker
Steven Parker
231,248 Points

It would help to see the entire environment. Can you make a workspace "snapshot" and share the link to that?