user3967551
user3967551

Reputation:

The image is not appearing as a style for the list why?

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

enter image description here

this is what i need

enter image description here

Upvotes: 0

Views: 100

Answers (2)

Alex Szabo
Alex Szabo

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; 
}

http://jsfiddle.net/ray8z48b/

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

RamRajVasavi
RamRajVasavi

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

Related Questions