Reputation:
The image is not appearing can anyone tell me why?
ul li {
background-image: url(logo.png);
background-repeat: no-repeat;
padding-left: 0px;
}
This is what appears
this is what i need
Upvotes: 0
Views: 100
Reputation: 3266
Getting the file path correct is the key, as it has been pointed out to me in the comments that for file paths without special characters the quotes are not mandatory.
This is mainly the code you have supplied, I've only changed the image (SO won't let me post the fiddle without some code, so that's why I'm putting it here).
ul li {
background-image: url('http://cdn.sstatic.net/stackoverflow/img/polyglot-404.png');
background-repeat: no-repeat;
padding-left: 0px;
}
If you include the above CSS in your HTML file between tags, than the logo.png has to be relative to the path of the HTML file.
If you link to a CSS file in a different directory, the logo.png has to be relative to that path.
For example, if I'd build a site, I'd have the root directory with all the HTML files, two folders (at least) one called "img" and one called "css".
So in the first case it would be "./img/logo.png"
or img/logo.png
in the latter it would be "../img/logo.png"
.
Upvotes: 3
Reputation: 906
I think about your problem. I have one solution. Here your Html file and your image in same folder,ohterwise you give path of logo.png in double quotes
ul li {
background-image: url("logo.png");
background-repeat: no-repeat;
padding-left: 0px;
}
I think it help you
Upvotes: -2