Reputation: 17
I am at my wit's end trying to link my CSS stylesheet to my HTML file, any and all help would be greatly appreciated!
my code is as follows:
<!DOCTYPE html>
<html>
<head>
<title>Christian Potts' Virtual Resume</title>
<style>
<link rel = "stylesheet"
type = "text/css"
href = "style.css" />
</style>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
stylesheet:
/* style.css */
h1 {
color: Blue;
}
Upvotes: 0
Views: 40
Reputation: 322
Your tag should be in the head tag, not the style tag
So it would be as followed:
<!DOCTYPE html>
<html>
<head>
<title>Christian Potts' Virtual Resume</title>
<link rel = "stylesheet" type = "text/css" href = "style.css" />
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
Upvotes: 0
Reputation: 623
Remove the <style>
tags around your <link>
tag.
The <style>
tag is used to define style information for an HTML document as known as CSS.
Inside the <style>
element you specify how HTML elements should render in a browser by writing CSS.
In a <style>
your write pure CSS. You can't link your stylesheet inside a <style>
tag.
You should end up with this:
<!DOCTYPE html>
<html>
<head>
<title>Christian Potts' Virtual Resume</title>
<link rel="stylesheet"
type="text/css"
href="style.css" />
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
Upvotes: 1