The only requirement for a webpage is one file.


While you may have many HTML files, the index file is the one loaded first by the browser if your site is online.

The index file can contain all the HTML and CSS for the page. However, it’s conventional to put your CSS into a different file.


Keeping types of code separate is important when your code gets larger and makes it easier to stay organized.

With your styles in this other file you simply need to ensure that your HTML file references your CSS file in its <head>.

<link href="style.css" rel="stylesheet" type="text/css" media="all" />

The ‘href’ attribute in that link element is the file path to your style.css file. If the index and style files are in the same place you won’t need to change the code above.