Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Background image not appearing HTML CSS

I am new to html/css and I do not understand why my background image is not showing up. This is part of a simple test CSS sheet and HTML code for a simple site. I am trying to add a background-image and I have done this once and it worked and I do not know why it does not work now.

body{
background: url (rio.jpg); 
background-size: cover; 
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover; 
}

This is part of my css sheet. THe url works, I have used it for another trial site before. And my html is just a regular html document with a body etc..


1 Answers

CSS is picky about functions.

You can't have a space after 'url' and the parenthesis.

Correct: background: url(path/to/image.jpg);

Incorrect: background: url (path/to/image.jpg);

Here's a fiddle demonstrating: http://jsfiddle.net/tJmmn/

like image 155
Eric Kidd Avatar answered Mar 05 '26 11:03

Eric Kidd