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 trialNana Ackah
Courses Plus Student 1,935 PointsHi everyone a beginner here, I am trying to link my css sheet to html file but seems not to be working any help?
I'm using Atom as my text editor.
2 Answers
Rich Donnellan
Treehouse Moderator 27,696 PointsDid you put something like this in the <head>
section of your HTML file?
<link rel="stylesheet" href="{path/to/css/file}">
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link
Shay Paustovsky
969 PointsHi Nana,
Linking to an external CSS document is done using the "<link> tag
The "LINK" Tag -
<link rel="stylesheet" href="">
Is a self closing/empty element therefore it doesn't need a closing counterpart tag.
The "rel" attribute describes the current relationship of the document being linked to the current document where it's being linked to.
In this example "stylesheet" value describes that the file being linked is a stylesheet to the current HTML document.
The "href" attribute describes the path to the file in the website's folder structure.
So in conclusion a <link> tag might look like this in a website:
<link rel="stylesheet" href="CSS/stylesheet.css">
This is one of the 3 CSS author rules:
- External (<link>)
- Internal (<style></style> - Tags are writted in the 'head' of the document and CSS rules are written between them.)
- Inline (<style="property:value;")
Hope this helped,
Happy Coding
Shay
Nana Ackah
Courses Plus Student 1,935 PointsNana Ackah
Courses Plus Student 1,935 PointsYes I did for some reason I thought the issue was something related to preview so I downloaded a setting on Atom and now I'm getting troubleshooting?!