Reputation: 5
I am trying to get a background image for my web page. I have a link to an external style sheet, which works fine (the CSS applies), but when I try to get the background image using background-image
it doesn't show the result. I have tried both absolute and relative URLs
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="generator" content="CoffeeCup HTML Editor (www.coffeecup.com)">
<meta name="created" content="Wed, 26 Mar 2014 04:01:34 GMT">
<meta name="description" content="">
<meta name="keywords" content="">
<title>Welcome to CSS</title>
<link rel="stylesheet" type="text/css" href="welcome.css" />
</head>
<body></body>
</html>
CSS:
body{
background-image:url('C:\Users\Neo\Documents\CoffeeCup Software\My
Website\Files\images.jpg');
background-repeat:repeat-x;
}
Upvotes: 0
Views: 164
Reputation: 27614
You can not set absolute path
from your locally. you can set absolute path only live web page. following way,
BODY { background-image: url(http://www.bg.com/pinkish.gif) }
another way set relative path
. I assume your root Website folder
__My Website
|__Files
|__images.jpg
|__welcome.css
|__welcome.html
It's relative to the style sheet, but I'd recommend making the urls relative to your url, base on above strutted set relative path on following way,
background-image:url('Files/images.jpg');
Upvotes: 1