Repository navigation
Description
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
v7.x
Current Behavior
Notice in the screen shot when every i put inputs inside of an ion card side by side the select label is pushed down by a few pixels.

Code:
<form>
<ion-card #cardmedtype>
<ion-card-header color="primary">
<ion-card-title><strong>Choose a Medication Type</strong></ion-card-title>
</ion-card-header>
<ion-card-content>
<ion-grid>
<ion-row>
<ion-col>
<ion-item>
<ion-input label="input" labelPlacement="stacked"></ion-input>
</ion-item>
</ion-col>
<ion-col>
<ion-item>
<ion-select label="select" labelPlacement="stacked"></ion-select>
</ion-item>
</ion-col>
</ion-row>
</ion-grid>
</ion-card-content>
</ion-card>
</form>
However removing it from the ion card solves the issue.
Code:
<form>
<ion-grid>
<ion-row>
<ion-col>
<ion-item>
<ion-input label="input" labelPlacement="stacked"></ion-input>
</ion-item>
</ion-col>
<ion-col>
<ion-item>
<ion-select label="select" labelPlacement="stacked"></ion-select>
</ion-item>
</ion-col>
</ion-row>
</ion-grid>
</form>
Expected Behavior
I should be able to see the labels aligned on the same horizontal axis regardless of whether or not they are in a card.
Steps to Reproduce
Create ion input with label and ion select with label side by side using ion-col (grid)
You will see the label are aligned horizontally.
However inside a card this is not the case.
My workaround for now...
import { Directive, ElementRef } from '@angular/core';
@Directive({
standalone: true,
selector: 'ion-select'
})
export class SelectLabelFixDirective {
constructor(private el: ElementRef) {
// console.warn('We have an ion select!', el.nativeElement);
const shadowRoot: DocumentFragment = this.el.nativeElement.shadowRoot;
if (shadowRoot) {
// console.warn('Fix Stacked Element Nested.: ', shadowRoot);
var style = document.createElement('style');
style.innerHTML = '.select-wrapper{ line-height: 18px; }';
shadowRoot.appendChild(style);
}
}
}
Code Reproduction URL
No response
Ionic Info
Ionic:
Ionic CLI : 7.0.0 (/Users/asd/.nvm/versions/node/v16.18.0/lib/node_modules/@ionic/cli)
Ionic Framework : not installed
@angular-devkit/build-angular : 15.2.4
@angular-devkit/schematics : 15.2.4
@angular/cli : 15.2.4
@ionic/angular-toolkit : 6.1.0
Capacitor:
Capacitor CLI : 4.6.1
@capacitor/android : 4.6.1
@capacitor/core : 4.6.1
@capacitor/ios : 4.6.1
Utility:
cordova-res : 0.15.4
native-run (update available: 1.7.2) : 1.7.1
System:
NodeJS : v16.18.0 (/Users/asd/.nvm/versions/node/v16.18.0/bin/node)
npm : 9.6.2
OS : macOS Unknown
Additional Information
No response


Activity
[-]bug: Label not aligned properly between ion input and ion select.[/-][+]bug: Label not aligned properly between ion input and ion select when in card component[/+]judsonmusic commentedon Apr 2, 2023
@sean-perkins this is a good one for you :) My work around is sketchy but it works. Hope this can get solved. Super weird.
liamdebeasi commentedon Apr 3, 2023
Thanks for the report. It looks like the
ion-cardline height styles are being inherited toion-select.Our global normalize styles applies
line-height: normaltolabelelements:ionic-framework/core/src/css/normalize.scss
Line 84 in 1638749
This works for
ion-inputbecause the<label>is in the Light DOM. The label onion-selectis in the Shadow DOM.To fix this we should probably apply
line-height: normalto the labels on input, textarea, and select. (There should be no visible change to input/textarea, but this avoids the issue in the event we move those components to use the Shadow DOM in the future)ionitron-bot commentedon May 20, 2023
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
fix(select): adjust label alignment when in a card (ionic-team#27202)