XHTML & CSS

+1 Szymon Zubal · August 21, 2015
Hey guys. I have recently started to learn XHTML & CSS but I have a problem. I did notice it's very common but I still did not find an answer that resolves the problem I have. So basically I am no on the 20th tutorial video which is about background images. I have tried dozen amount of different images, different formats of images and I still cannot add any image to the background. All the time it's blank. I have checked my code also many times and it looks correct. Also the images I am using are in the folder where the file I work on is placed, so this is not a problem as well. Here is my code:
<!doctype html>

<html>
<head>
      <style type="text/css">
            body {
                   background-image:url (leniwiec.jpg);
                      }
</style>
</head>
<body>

</body>
</html>
THanks for help guys!!!

Post a Reply

Replies

Oldest  Newest  Rating
+1 Jeff the Killer · August 22, 2015
<html>
<head>
<style type="text/css">
body {
background-image:url ("leniwiec.jpg");
}
</style>
</head>
<body>

</body>
</html>

if this doesn't work then is your file in the same directory/folder as your html document?
0 Szymon Zubal · August 22, 2015
I got it guys. For a weird reason when I have placed a space after url it worked. So originally it was this:
background-image:url (leniwiec.jpg);

and when I have placed a space before url and deleted the spece after url it worked for me. Oh and also I have placed quotation marks around the image name so it looke like this:

background-image: url("leniwiec.jpg");

Maybe this will help other people as well:) 
  • 1

HTML / CSS / Web Design

107,015 followers
About

Discuss, share, ask, learn and teach HTML5 and CSS3.

Links
Moderators