Developers avoid mixing code by storing HTML and CSS code in separate files (HTML files contain only HTML code, and CSS files contain only CSS code).

You can create an external stylesheet by using the .css file name extension, like so: style.css

With an external stylesheet, you can write all the CSS code needed to style a page without sacrificing the readability and maintainability of your HTML file.



Take a look at index.html. Cut the CSS code ruleset in between the opening and closing <style> tags and paste it directly into the file called style.css.

Delete the remaining <style> element (now empty) from index.html and press the Run button.

Hmm, the font changes didn’t take effect? Click the Next button to find out why.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?