How do I link my HTML and CSS?

Linking HTML and CSS can be tricky in your first few projects, and it’s not unusual to struggle a bit in getting it right. Try including the following code in the head of your HTML project.

<link rel="stylesheet" href="yourcssfilehere">

With yourcssfilehere you need to instruct your browser on where to find the CSS file. This could be an absolute link or a relative one (read more on the difference). Typically your CSS file will be in a resources directory and css subdirectory.

For more help and explanations, watch this walkthrough:

If you have questions or contributions about how this all works in theory, please reply to this thread! If you’re having trouble with your own project, start a new post in our CSS help section.

6 Likes

Does it make a difference if the attribute type is added or not to the link element?

seems like a good question for documentation:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-type

1 Like

Link was helpful…
Thank You

MDN is a good resource/documentation when it comes to html, css and JS