The correct place to refer to the external style sheet in an HTML document is inside the head section. The head section locates at the topmost part of the HTML document, and it’s where you add the external style sheet code to access the CSS file from which you can use it to apply the stylings to an HTML web page.

A code example

Let’s say you have created a CSS file named style.css, and you got an external style sheet code that looks like this:

<link rel="stylesheet" href="style.css" />

You insert the code anywhere between the opening <head> tag and the closing </head> tag. Here’s an example of how it’s done:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="style.css" />
    <title>Example site</title>
  </head>
  <body>...</body>
</html>

And that’s pretty much of it. You have linked the CSS file to the HTML web page, and now the CSS styles should be working.

Get my free e-book to prepare for the technical interview or start to Learn Full-Stack JavaScript