0

The issue I am having is in CodeSanbox.io. Below you will see the code for my HTML file (index.html), as well as the code for my linked CSS file (styles.css), which is in a folder titled css.

<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" href="./css/styles.css" />
    <title>Test project</title>
    <meta charset=UTF-8" />
  </head>
  <body>
    <h1>Hello</h1>
    <div></div>
  </body>
</html>

CSS Code:

div {
  width: 20px; height: 200px; background-color: blue; opacity: 50%;
}

body {
  background-color: red;
}

When I view the CSS file, the contents of both the HTML and CSS file are shown. When I view the HTML file, only the contents of the HTML file are shown.

Hsabes
  • 21
  • 3
  • Try removing the . in ```./css/styles.css``` or else the system will read the . as a folder or something else. – Calvin Tanuri Mar 17 '22 at 05:46
  • I tried this and it did not work. I double checked another resource on how to link CSS files to HTML, and it uses the format that I have in the link element. – Hsabes Mar 17 '22 at 05:55
  • Can you share a link or screenshot or something? – General Grievance Mar 17 '22 at 11:57
  • Here is a screen shot of both files: https://imgur.com/a/tzWfTLR Here is the Sandbox link: https://codesandbox.io/s/still-sun-feq5bj?file=/index.html – Hsabes Mar 17 '22 at 16:47

0 Answers0