Reputation: 57
I am trying from one hour to add an image as button in ionic , the image is png with transparent background but failed it always show a white background my code is:
<p align="center"><button (click)="buttonTapped()">
<ion-img style="width: 150px; height: 150px; background: transparent
!important;" src="img/btn1.png"></ion-img> </button>
Upvotes: 4
Views: 5814
Reputation: 5013
You can remove the <button>
-element and place the (click)
-handler on the <ion-img>
-tag directly. Also to set background color use background-color
not background
Your code would look something like this:
<p align="center"><ion-img (click)="buttonTapped()"style="width: 150px;
height: 150px; background: transparent !important;" src="img/btn1.png">
</ion-img>
Upvotes: 4