Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove "padding" from ionic card

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:

You can see the bottom padding-like space

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?

like image 912
kankamuso Avatar asked Aug 09 '16 14:08

kankamuso


People also ask

How do you remove padding from ionic?

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] .

What is ion 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.

What is ion card content?

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.


1 Answers

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>
like image 124
arshcaptano Avatar answered Sep 30 '22 06:09

arshcaptano