I have a HTML, CSS, and JS application that is functioning with cordova. My goal is to display a WhatsApp icon image on the page using a CSS background image.
Although the image is loaded, it is not being displayed and there are no errors related to forbidden access or the image not being found in the console...
- I attempted to display the image using
<img />
, but it was unsuccessful. - I tried utilizing the CSS property:
background-size: contain !important;
- I experimented with changing the value of
background-position
. - I tested adding the
background-image
inline within the css style of the element. - I even added text to the
<a>
element.
Unfortunately, none of these methods were successful!
Below is my code :
.whatsapp-icon {
background-size: contain;
border-radius: 5px;
margin-top: 10px;
height: 35px;
width: 35px;
display: block;
float: right;
text-decoration: none;
}
<div class='theDownBar'>
<a style='background-image: url(img/whatsapp-icon.png);' href='https://api.whatsapp.com/send?phone=phonenumber' class='whatsapp-icon'></a>
</div>
UPDATED : Included images for clarification
The element is visible and has specified dimensions
https://i.sstatic.net/HLNzL.png
There are no console errors, and the image was successfully loaded when checking the source https://i.sstatic.net/NEeQT.png