solaire
solaire

Reputation: 505

Remove spacing in ion-list

I try to remove the spacing between the items. as you can see the list takes up a log of space vertically and i need the text closer together but I want to keep the lines.

I tried a ton of different css stuff (setting margins/paddings to 0 and reduce max-height)but it always cuts off the line and the text instead of just removing the space between.

List

enter image description here

     <ion-card>
            <ion-card-header>
                <ion-card-subtitle>
                Tichumaster
                </ion-card-subtitle>
                <ion-card-title>
                    <ion-icon class="iconSize" name="aperture"></ion-icon>
                </ion-card-title>
                <ion-card-content>
                    <ion-list>
                        <ion-item>
                                <ion-label>Du</ion-label>
                                <ion-note slot="end" color="tertiary">10%</ion-note>
                        </ion-item>
                        <ion-item>
                            <ion-label>Du</ion-label>
                            <ion-note slot="end" color="tertiary">10%</ion-note>
                        </ion-item>
                        <ion-item>
                            <ion-label>Du</ion-label>
                            <ion-note slot="end" color="tertiary">10%</ion-note>
                        </ion-item>
                        <ion-item>
                            <ion-label>Du</ion-label>
                            <ion-note slot="end" color="tertiary">10%</ion-note>
                        </ion-item>
                    </ion-list>
                </ion-card-content>
            </ion-card-header>
        </ion-card>

Upvotes: 1

Views: 1633

Answers (1)

Rodrigo Sze
Rodrigo Sze

Reputation: 44

I had a hard time also doing that. But I managed to achieve doing

ion-item.myList{
  margin-top: -11px; 
}

But to not interfere on all ion-item I was using, I used a class

<ion-item class="myList">

Upvotes: 1

Related Questions