I am trying to insert inamges inside ionic cards. I preferred to use cards because I want to keep aspect homogeneous. The problem is that, as you can see on the next image, there is a white space at the bottom (more evident here, but also present at top and sides) of the card after an image:
I have tried using CSS but no luck. In part it is probably because I don't know which CSS is involved. Also, I don't really know how to remove such white space.. I even tried using negative padding values but it does not work so I suppose it is not really the card component but a subpart which is doing the issue.
This is my current code:
<div class="card" ng-controller="cycleImagesCtrl">
<div class="item item-body" style="padding: 0px 0px 0px 0px;">
<img src={{imgTitle}} width="100%" />
</div>
</div>
Any hints?
try to add an id = 'ion-overrides' or whatever you want to call it to your body element and then in your scss change the ion-app.md [padding] . scroll-content {...} to #ion-overrides ion-app.md [padding] .
Ionic offers an easy way to add padding to elements. There are couple of classes that can be used and all of them will add 10px between border of element and its content. The following table displays all the available padding classes.
IONIC Cards. Cards are a popular UI component that serves as an entry point to more detailed information. They should be easy to scan for relevant and actionable information. A card can be a single component, but usually it's made up of multiple elements like header, title, image, content and actions.
Add margin: 0 !important;
and padding: 0 !important;
for your card's css. Like this:
ion-card {
width:100%;
height:300px;
margin: 0 !important;
padding: 0 !important;
}
ion-card > img {
width: 100%;
height: 100%;
}
<ion-card>
<img src="...">
</ion-card>
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