How do I make items in an Ionic list smaller (less

2019-07-10 03:27发布

问题:

The items in a standard ion-list of ion-items are too big for my app. How do I make them vertically smaller/shorter?

It seems that trying to modify the margin properties of the .item class yields results that are, well, complete nonsense. This is not the answer. Modifying the padding properties of the same seems not to do anything. Also not the answer.

回答1:

You need to modify the properties of the .item-content class.

The following code will reduce the padding on list items from the comically large 16px default to a more manageable 12px.

.item-content {
    padding-top: 12px;
    padding-bottom: 12px;
    margin-top: -4px;
    margin-bottom: -4px;
    height: 70px;
}