Reputation: 85
I'm not sure what I'm missing. I think I have everything defined correctly but the background image doesn't show. Here's the code and jsfiddle, (I used the google logo for the background image in this example. I assume that works?)
#main_links a span {
display: none;
}
#main_links {
top: 100px;
clear: right;
float: right;
list-style-type: none;
width: 728px;
margin: 0 auto;
padding: 38px 0px 0px 0px;
}
#main_links li {
display: inline-block;
list-style-type: none;
padding: 0px 20px 0 0;
height: 29px;
border: 1px solid #000000;
}
#link1 a {
width: 113px;
display: block;
background: url('https://www.google.com/images/srpr/logo11w.png') no-repeat;
}
Upvotes: 0
Views: 5567
Reputation: 1
Do the following Check:
min-height
for the image container.background-size
.If the image URL is correct, the possible reason for missing image is you do not set background-size.
Upvotes: 0
Reputation: 4699
The @CBroe comment is precise (you are not displaying the a
content). Then, to see the image you need to set the image to background of #link1
and not #link1 a
:
#link1 a {
width: 113px;
display: block;
}
#link1 {
background: url('https://www.google.com/images/srpr/logo11w.png') no-repeat;
}
Upvotes: 4