Home > Mobile >  Problem with link CSS and html in VS code. Problem with external CSS file
Problem with link CSS and html in VS code. Problem with external CSS file

Time:02-02

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.

CodePudding user response:

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

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

CodePudding user response:

<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

  • Related