Christian Potts
Christian Potts

Reputation: 17

Linking css and html files

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

Answers (3)

Elisa L
Elisa L

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

Priya
Priya

Reputation: 1554

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

Upvotes: 0

Konstantin Kreft
Konstantin Kreft

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

Related Questions