Reputation: 51
Hi I'm new to learning html and css and been really struggling with this problem. I can't link to an eternal CSS file, it just won't work when testing on my web host, I'm sure the file name is right though and it the css works fine when hosting locally. It's saved as "test.css" and is in the same folder as the "index.html" file.
This is my HTML -
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="test.css">
</head>
<body>
<p>This is some text</p>
</body>
</html>
This is my CSS
<style type="text/css">
p {background-color: blue;}
</style>
Any help would be greatly appreciated!
Upvotes: 0
Views: 198
Reputation: 9451
</style>
from your header<head>
<link rel="stylesheet" type="text/css" href="test.css">
</head>
<style>
tags from css filep {
background-color: blue;
}
Upvotes: 1
Reputation: 2395
In your CSS there is no need to wrap your code in a <style>
tag, that is only necessary in HTML.
Also not sure why there is a closing </style>
tag below your <link>
tag. There is currently no inline styling here in the head of your document.
<!DOCTYPE html>
<link rel="stylesheet" type="text/css" href="test.css">
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
</head>
Upvotes: 0
Reputation: 13679
There's no need to include <style type="text/css">
in your css file. Remove that and just put:
p {
background-color: blue;
}
The only time you put <style type="text/css">
is when you're putting the your css directly in your HTML file.
Upvotes: 0