I created a ionic project:
ionic start test blank
And add a button:
<button class="button button-clear" ng-click="">
<img style="width:50%" class="round-button" src="img/button.png" alt="">
</button>
The image is:
It’s working fine in browser and Android phone. But in ios simulator. it looks like this:
P.S.: If I change the image to rectangle image, it will be fine.
Any idea? Thanks.
Nobody encountered the same issue?
SDEK
March 14, 2016, 4:14pm
3
Did you tried giving it a height:auto ?
Yes. I tried. But it didn’t help. It only happened for image button and for ios simulator only. Have a look at my code:
<div style="text-align:center;">
<img style="width:200px;height:auto;" src="img/round.png" alt="">
</div>
<div style="text-align:center;">
<button class="button button-clear">
<img style="width:200px;height:200px;" src="img/round.png">
</button>
</div>
Result:
Don’t know if it’s bug or not. I modified my code:
<div style="text-align:center;">
<img ng-click="onClick()" style="width:200px;height:auto;cursor: pointer; " src="img/round.png" alt="">
</div>
<div style="text-align:center;">
<button style="width:120px;height:120px;line-height:120px;" class="button button-clear">
<img style="width:120px;height:120px;line-height:120px;" src="img/box.png">
</button>
</div>
<div style="text-align:center;">
<button class='button button-positive' style="width:120px;height:120px;line-height:120px;">
Large button
</button>
</div>
As you can see, no matter what I did. The height of button image is not correct. But the button with text is ok if I change the size.
P.S. : Actually the image shape has nothing to do with the problem.
SDEK
March 15, 2016, 4:32pm
6
why are you using the tag inside the in first place?
check this out, maybe this helps:
html, css, button
Thanks.
For me, it seems the button height is not changeable in ionic no matter I include img or set image as background. That seems to be the reason of my problem. But anyway I’m able to replace all buttons with just normal images in my case. That will resolve my problem.
SDEK
March 18, 2016, 9:33am
8
you can override the css with !important like
height: 120px !important
did you try that?
Yes. I tried this before.
No solution works. Currently I changed all button with image. Although it’s no problem to capture onclick event, there is no way for me to set the disabled status like what button did.