Reputation: 79
Could anyone tell me why my page isn't linking to the CSS
? I have both HTML
and CSS
file in the same folder.
Here's my HTML
:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type = "text/css" href="style.css">
<title> Flying Fish Painting Company </title>
</head>
<body>
<h1> Flying Fish Painting Company </h1>
</body>
</html>
And this is my CSS
:
h1{
color:blue;
}
Upvotes: 0
Views: 92
Reputation: 529
It works fine for me.
If I put both files in the same folder then it also works
<link rel="stylesheet" type="text/css" href="style.css">
if you put your CSS file in a different folder that time.
Syntax:
<link rel="stylesheet" type="text/css" href="foldername/filename.css">
You should write:
<link rel="stylesheet" type="text/css" href="css/style.css">
Upvotes: 2
Reputation: 1329
There is nothing wrong with this code except the spaces mentioned above. Works fine for me. Check for typos and make sure it is in the same folder.
Upvotes: 0
Reputation: 1
Is this your exact html code or just an example?
There are a couple of spaces before and after your = on the type you should remove.
Personally I find it better to put all css in a subfolder. It shouldn't make a difference however it makes for easier organization.
For a single css style like that I would just put it in line the html unless this is something you want across several html files.
Upvotes: 0
Reputation: 45
Could you check the spaces:
type = "text/css"
change to:
type="text/css"
Upvotes: 0