user
In HTML how to import an external CSS file ?
alphonsio

To import an external CSS file into your HTML document, you can use the link element within the head section of your HTML file.

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

The link element should have the following attributes:

  • rel: specifies the relationship between the HTML document and the linked file. In this case, it should be set to "stylesheet".
  • href: specifies the location of the external CSS file. This can be a relative or absolute path.

Here's an example of how to import an external CSS file called "style.css" located in the same directory as your HTML file:

<!DOCTYPE html>
<html>
<head>
  <title>My Web Page</title>
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <!-- Your HTML content goes here -->
</body>
</html>

Make sure that the file name and path are correct, otherwise, the CSS file won't be loaded, and your HTML document won't be styled as expected.