Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

background: url('example.jpg'); Does not work!

Tags:

html

css

Okay here's my file structure:

+WWW

  • index.html
  • style.css
  • map.jpg

CSS:

body {
    background: #000 url('map.jpg') repeat/repeat-x/repeat-y/no-repeat scroll/fixed top/center/bottom/x-%/x-pos left/center/right/y-%/y-pos;
}

HTML:

<html>
<head>
    <link rel="stylesheet" href="style.css" type="text/css" media="screen" title="no title" charset="utf-8">
</head>
<body>
</body>
</html>

PROBLEM: map.jpg does not display in any browser (Firefox, Safari) Or TextMate Preview!

like image 665
Caius Eugene Avatar asked Dec 29 '22 05:12

Caius Eugene


1 Answers

You have two issues here, first is your CSS being off, it shouldn't have that laundry list of options for each argument left in there:

body {
  background: #000 url('map.jpg');
}

Then your <body> doesn't have any content, so it has no dimensions, you'll need to put something in there to see much if any of the image, otherwise the <body> element's height is going to be very small if not 0, depending on the browser.

like image 96
Nick Craver Avatar answered Dec 30 '22 22:12

Nick Craver