I am trying to call image using img
and this is my code:
<img src="/pc/images/leader.png">
is this possible to put this in css? like this code: without using background-image.
css
.leader{
src: /pc/images/leader.png;
}
html
<img class="leader">
thanks :)
No. You can't do it with css.
CSS has no use of foreground images. You can only use background images.
However, if I understand your problem, you can do place the image using pseudo element:
.leader::after{
content: "";
background: url(path.jpg) no-repeat;
position:absolute;
top: 0;
left: 0;
width: 50%;
height: 300px;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With