0

I am trying to get a background on a test website for a class.

body{
margin: 0px;
padding: 0px;
background-image: url(Resorces/Background.png) repeat;}

This is from the CSS file
The HTML file looks like this

<!DOCTYPE html>
<html>
<head>
<style type="text/css">
</style>
<title>Raster Vector Home</title>
<link href="css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Hi</h1>
</body>
</html>
nukeLEAR
  • 25
  • 7
  • Use quotation marks like `url("Resorces/Background.png")` – pbaldauf Dec 07 '14 at 17:22
  • First, you're missing quotations in the image path. Second, you can't have `repeat` in the `background-image` rule. It should look like this: `background-image: url("Resorces/Background.png");`. Also, please check if your path is correct relative to the .css file. – Томица Кораћ Dec 07 '14 at 17:22

1 Answers1

2

Your syntax is incorrect.

  1. You cannot have repeat in background-image.
  2. You should wrap the image url with single (') or double quote (") characters.

Instead, either create a separate attribute for background-repeat

body{
    margin: 0px;
    padding: 0px;
    background-image: url('Resorces/Background.png');
    background-repeat: repeat;
}

Or, just use the background attribute:

body{
    margin: 0px;
    padding: 0px;
    background: url('Resorces/Background.png') repeat;
}

For more information on CSS background properties, see: W3C: 14 Colors and Backgrounds

Axel
  • 10,732
  • 2
  • 30
  • 43
  • Just to be a bit pedantic. [The quotes are not required, with a minor caveat that certain characters need to be escaped](http://stackoverflow.com/a/851753/2930477). – misterManSam Dec 07 '14 at 17:59