How can i link my CSS with my HTML files?

ghz 8months ago ⋅ 118 views

for some reason I can't link my css with my html. I've already tried putting <link rel="stylesheet" href="style.css" type="text/css"/> or <link rel="stylesheet" href="../views/style.css" type="text /css"/> and none of the options will

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>List</title>
<link rel="stylesheet" href="../views/style.css" type="text/css"/> 
<link rel="stylesheet" href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css">

here is my file structure:

https://i.stack.imgur.com/TgqUI.png

https://prnt.sc/GwVmb6kIrceC

Answers

It seems like you're trying to link the CSS file using a relative path. Based on your file structure screenshot, if your HTML file is located in the client directory and your CSS file is located in the client/views directory, you should use a relative path like this:

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

This path indicates that the CSS file is located in the views directory inside the client directory where your HTML file is located.

If this doesn't work, double-check the file names and directory names for any typos or inconsistencies. Also, ensure that the CSS file is saved with the correct extension (.css). If the issue persists, you might need to check the browser's developer tools console for any error messages related to loading the CSS file.