skip to Main Content

I am working in VS code and I am beginner. I know how to write css in html style but css doesn´t work in external file.

My code:

<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>WHY</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="style" href="style.css">
<style>
</style>
<body>
    <h1>rozkaz</h1>
    <p>smiech</p>
    <b>haha</b>
    <em>hehe</em>
    <mark style="background-color: blue;">hihi</mark>
    <p>Das ist  <del>ein</del>  kein Hund.</p>
    <p>Das ist  <del>ein</del>  <ins>kein</ins>  Hund.</p>
    <sup>hoho</sup>
</body>
</html>

CSS:

h1 {
    color: bisque;
}

I tried lot of tutorials but it didn´t work.

2

Answers


  1. You have an error in the link tag. The rel attribute should be "stylesheet" instead of "style".

    <link rel="stylesheet" href="style.css">
    
    Login or Signup to reply.
  2. <head>
      <link rel="stylesheet" href="style.css">
    </head>
    

    rel="style" should be replaced with rel="stylesheet".
    also, it is better to include stylesheets inside a <head> tag

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search