0

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!

  • they are in the same folder
  • my ide of choice is notepad++ (if that makes a difference)
  • the naming of each file is correct
  • I have tried multiple browsers

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;
}
0

3 Answers 3

1

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>

Sign up to request clarification or add additional context in comments.

1 Comment

You're welcome. BTW welcome to StackOverflow. It is appreciated to accepted the answer which is working for you. Voting is also appreciated.
0

Remove <style> tag which is wrapped around <link> tag.

Comments

0

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>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.