Tyrionus
Tyrionus

Reputation: 23

CSS stylesheet not linking to html

So I am trying to use a stylesheet for the background-image of my html page. And it just isn't linking or just isn't working. (Yes html and css files are all within the same directory/folder).

This is my code that I have used

<html>
<head>
<link href="stylesheet1.css" rel="stylesheet" type="text/css">
<body>
<center> <p style="border:1px solid white; padding:15px; color:blue;      font-family:courier; font-size:200%;"> Welcome
</body>
</head>
</html>

and then the stylesheet code itself contains this. and even in the link type, i have tried using /png/image.

body {
        background-image: url("image-name-here.png");
        backgound-repeat: no-repeat;
        background-position: center top;
}

and yes i have tried replacing the tag body with head.

Upvotes: 0

Views: 102

Answers (1)

Sebastian
Sebastian

Reputation: 66

You had a spelling mistake in background-repeat, you spelled it as backgound-repeat. Also, if you haven't already, there needs to be a <body></body> tag in the HTML.

Update the HTML,

<!DOCTYPE html>
<html>
<head>
<link href="stylesheet1.css" rel="stylesheet" type="text/css">
...
</head>
<body>
...
</body>
</html>

CSS,

Fix the mistake in your stylesheet,

body {
   background-image: url("image-name-here.png");
   background-repeat: no-repeat;
   background-position: center top;
}

Upvotes: 1

Related Questions