0

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

http://jsfiddle.net/SqHE8/

2
  • 3
    Since you removed all content from the a elements, they get no height until you set one. Commented Feb 5, 2014 at 3:10
  • Explaining better, the problem is not the height or the elements being removed. The problem is that the a content is not visible. Commented Feb 5, 2014 at 3:32

2 Answers 2

4

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;
}
Sign up to request clarification or add additional context in comments.

1 Comment

it's kind of funny that you get the reputation points for CBRoe's answer, but he should have posted it in the answer section and not the comments section
0

Do the following Check:

  1. Check the image URL.
  2. Set min-height for the image container.
  3. Set background-size.

If the image URL is correct, the possible reason for missing image is you do not set background-size.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.