-1

So I'm trying to import a CSS stylesheet from JavaScript, and my HTML file is in JavaScript/JavaScript events, so I did this.

<Head>
    <title>Javascript</title>
    <link href="../styles.css" rel="stylesheet">
</Head>
<body>

../ is meant to go back and then to the styles.css file. But when I open a live server to see if the styles are working, they are not showing up.

Here is my CSS code:

body {
  font-family: Arial, Helvetica, sans-serif;
  color: rgb(119, 114, 114)
}

ul .done {
  text-decoration: line-through;
}
Nat Riddle
  • 928
  • 1
  • 10
  • 24

1 Answers1

0

Alwais use absolute path like: https://somedomain.com/style.css

or relative path beginnig slash like: /style.css

then browser will always find correct file path.

step
  • 2,254
  • 2
  • 23
  • 45