0

I am trying to display my logo from CSS and it will not display.

When I inspect the element it shows that the image is there but will not appear on the web page.

CODE

#logo_image {
  margin-top: 13px;
  float: left;
  background: url(images/logo_color.png) no-repeat;
  padding: 8px 16px 8px 16px;
}
<a href="index.html" id="logo_terra"></a>

2
  • Firstly, your CSS declaration should be #logo_terra { ... } to match your existing markup. Secondly, it's worth noting that using a URL-based background is going to cause your image to be referenced relative to where the CSS definition is. If it's in an external file, then the URL will need to be relative to that, if it is defined within an actual HTML page, then the same thing applies. Have you tried defining it as an absolute URL to see if that works? Commented Jun 2, 2016 at 19:27
  • 1
    Also the CSS is referencing ID "#logo_image" while the HTML is using ID "#logo_terra" Commented Jun 2, 2016 at 19:28

3 Answers 3

3

your ID is wrong, just change to #logo_terra, plus you should have width and height, otherwise you only will have the padding size

#logo_terra {
  margin-top: 13px;
  float: left;
  background: url(//lorempixel.com/100/100) no-repeat;
  padding: 8px 16px;
  width: 100px;
  height: 100px
}
<a href="index.html" id="logo_terra"></a>

Sign up to request clarification or add additional context in comments.

2 Comments

I want ask you something not related to this topic, in which chatroom you are available or how can I contact you ?
@MadanBhandari in my profile you have my contacts, feel free to reach me there.
0

id is wrong in CSS

Should be #logo_terra

Comments

0

Hi your CSS doesn't refer to the ID of your HTML. You have an id called "logo_terra" so you have to refer this same ID to CSS also. So make sure you refer #logo_terra, instead of #logo_img.

Second: MOST IMPORTANT for NEWBIES:

Your image must be in the folder that is relative to your CSS stylesheet. It depends on where you have saved the images.

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.