Noah P
Noah P

Reputation: 13

I can't change anything in my CSS, nothing takes effect

This is my index.html

<!DOCTYPE html>
<html>
<head>
<title>HTML, CSS and JavaScript demo</title>
</head>
<header>
  <div id="navbar">
  <div id="Home"><h1>Home</h1> </div>
</div>
</header>
<body>
</body>
</html>

style.css

#navbar{
  background-color: #666666;
  text-align: right;
}

All the HTML I write is fine but whenever I try to change something with CSS nothing happens, please help.

Upvotes: 0

Views: 927

Answers (2)

Kundan
Kundan

Reputation: 1952

Add the code below between your <head></head> tag.

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

Upvotes: 0

DCR
DCR

Reputation: 15665

In your head tags you need to add:

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

the href may need to be adjusted with the path of style.css, If it is in the same folder as index.html it should be fine

I would recommend reading over this website, here is a direct link to your current issue: https://www.w3schools.com/html/html_css.asp

Upvotes: 3

Related Questions