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 trialNick Karastogiannis
Courses Plus Student 2,712 PointsMy 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?
8 Answers
Andrew Molloy
37,259 PointsWhat'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?
Nick Karastogiannis
Courses Plus Student 2,712 PointsHere 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.
Andrew Molloy
37,259 PointsWhat'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
25,806 PointsI 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.
Nick Karastogiannis
Courses Plus Student 2,712 PointsDo you have to pay for the Sublime or Brackets text editors ?
Andrew Molloy
37,259 PointsNick Karastogiannis Brackets is free and open source (http://brackets.io/), Sublime is paid for (http://www.sublimetext.com/)
Nick Karastogiannis
Courses Plus Student 2,712 PointsWill windows 8.1 have the text editors that you mentioned ?
Andrew Molloy
37,259 PointsYou 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.
Michael Quiapos
Courses Plus Student 14,537 PointsHi 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.
Nick Karastogiannis
Courses Plus Student 2,712 PointsYes, I've even included the rel and hreference.
Andrew Molloy
37,259 PointsNick Karastogiannis we still need to see your actual formatted code to make sure. Use the markdown instructions already posted.
Nick Karastogiannis
Courses Plus Student 2,712 PointsI tried to post the code in my comments but it wont show up at all. By the way, I downloaded the "Bracket" text editor.
Andrew Molloy
37,259 PointsDid 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.
Nick Karastogiannis
Courses Plus Student 2,712 PointsThank you for your patients and help. The code I wrote is: <link rel="stylesheet" href="CSS/style.css">
Andrew Molloy
37,259 PointsIs your style.css files inside a folder called "CSS" all caps? Could we see the entire HTML code you have?
Nick Karastogiannis
Courses Plus Student 2,712 Pointssure:
<!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
25,806 PointsDo you have a folder called CSS with style.css inside?
Nick Karastogiannis
Courses Plus Student 2,712 Pointsyes I did, that's one of the first things I did.
Nick Karastogiannis
Courses Plus Student 2,712 PointsIn the beginning, I opened up my html document with a Google Chrome web browser. Do you think that is my problem?
Andrew McCormick
17,730 PointsAndrew McCormick
17,730 Pointsas stated. We need to see your code. Please see How to post code to forum