Codecademy Forums

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.

4 Likes