Home > Net >  Overlaying an image on another
Overlaying an image on another

Time:08-04

I am using this code to show image

<img  />

<style>
    .imgpath{    
        width: 32px;
        height: 32px;
        background-image: url(/images/logout.png);
        background-repeat: no-repeat;
    }
</style>

but I am getting this
enter image description here

What is causing this and how can I fix it?
This is my image
enter image description here

CodePudding user response:

When using the img html tag, you are supposed to specify the src. Since you didn't, it displays a default small image showing that the browser couldn't get an image from src.

You have at least two possibilities depending on what you intend to do:

Use src and remove background css rules: <img src="/images/logout.png"/>

Use another html tag, example: <div ></div>

  • Related