Material-components-web: mdc-textfield and mdc-select: Selection boxes and text fields go out of alignment when one filled in and one not

Created on 26 Aug 2019  路  2Comments  路  Source: material-components/material-components-web

Bug report

Selection boxes and text fields go out of alignment when one filled in and one not

Steps to reproduce

<div class="mdc-text-field mdc-text-field--outlined">
    <input class="mdc-text-field__input">
    <div class="mdc-notched-outline">
        <div class="mdc-notched-outline__leading" />
        <div class="mdc-notched-outline__notch">
            <label class="mdc-floating-label">Name</label>
        </div>
        <div class="mdc-notched-outline__trailing" />
    </div>
</div>
<div class="mdc-select mdc-select--outlined">
    <i class="mdc-select__dropdown-icon" />
    <select class="mdc-select__native-control">
        <option value="16-25">16-25</option>
        <option value="26-35">26-35</option>
        <option value="36-45">36-45</option>
        <option value="46-55">46-55</option>
        <option value="56-65">56-65</option>
        <option value="65+">65+</option>
    </select>
    <div class="mdc-notched-outline">
        <div class="mdc-notched-outline__leading" />
        <div class="mdc-notched-outline__notch">
            <label class="mdc-floating-label">Age</label>
        </div>
        <div class="mdc-notched-outline__trailing" />
    </div>
</div>

Actual behavior

Screenshot 2019-08-26 at 14 30 02

Screenshot 2019-08-26 at 14 31 33

Expected behavior

Screenshot 2019-08-26 at 14 39 36

Your Environment:

Packages:

Screenshot 2019-08-26 at 14 37 25

Browser:

Screenshot 2019-08-26 at 14 37 58

As well as Chrome 76

OS:

MacOS Mojave, 10.14.6 (18G87) & Windows 10

Thank you!!!

bug

Most helpful comment

This is caused because .mdc-select is an inline element, just add this in your css

.mdc-text-field, .mdc-select{
    vertical-align: middle;
}

All 2 comments

This is caused because .mdc-select is an inline element, just add this in your css

.mdc-text-field, .mdc-select{
    vertical-align: middle;
}

Thanks @Darhakexge that did the job :)

Was this page helpful?
0 / 5 - 0 ratings