Materialize: Make textfield icons align with textfields

Created on 16 Jun 2017  路  9Comments  路  Source: Dogfalo/materialize

Description

When giving a textfield an icon the vertical icon alignment is off.

Repro Steps

<div class="input-field">
    <i class="material-icons prefix">vpn_key</i>
    <input id="token" type="text" class="validate" maxlength="10">
    <label for="token">Anmeldecode</label>
</div>

Screenshots / Codepen

https://codepen.io/Fylipp/pen/zzoezO
image

Most helpful comment

Please try the code from the CSS tab.

https://codepen.io/anon/pen/rwjVba

All 9 comments

Please try the code from the CSS tab.

https://codepen.io/anon/pen/rwjVba

That works nicely, why is it not that way by default?

@tomscholz Hm, should we pick this or another value?

I think .5 rem is actually perfect since it is aligned with the label.
image

@Fylipp right, this is what I tested in the ChromeDevTools but I did not test further how other icons react and if another approach is better.

The @DanielRuf's solution is perfect!

@DanielRuf is this issue going to be addressed in the future? I created a ~PR~ new PR that solves the issue the way you proposed.

The team will probably merge the PR.

Fixed in 3b8cf2d463db63444e73c8157660379ef3f64c6f

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MickaelH974 picture MickaelH974  路  3Comments

acierpinski picture acierpinski  路  3Comments

djensen47 picture djensen47  路  3Comments

lpgeiger picture lpgeiger  路  3Comments

serkandurusoy picture serkandurusoy  路  3Comments