Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

input height differences in Firefox and Chrome

Why height in Chrome is bigger than Firefox of input

See example here http://jsfiddle.net/jitendravyas/89Msh/1/

select, input, textarea, button {
    font: 99% sans-serif;
}

input, select {
    vertical-align: middle;
}

body, select, input, textarea {
    color: #444444;
}

button, input, select, textarea {
    margin: 0;
}


input, textarea {
    font-family: inherit;

    line-height: 1.5;
}


input {
    border: 0 none;
    font-size: 32px;
    line-height: 1.1;
    margin-right: 29px;
    padding: 3px 3px 0;
    width: 206px;
    border-radius: 7px;
}
like image 408
Jitendra Vyas Avatar asked Aug 29 '11 11:08

Jitendra Vyas


3 Answers

The problem is essentially line-height.

Chrome sees line-height much like it sees height and Firefox doesn't.

Adding height to the input should solve the problem, though you should be careful that your line-height and height match.

For example: height: 20px; line-height: 20px;.

http://jsfiddle.net/e2agj/1/ - Last example input is the correct one.

like image 96
Joonas Avatar answered Sep 30 '22 03:09

Joonas


Simply try overflow:hidden on input

like image 20
Raa Vijay Avatar answered Sep 30 '22 04:09

Raa Vijay


I usually use padding instead of height to push the total height of the input. Doing so, I do not have to fight around with the different interpretations of Chrome and Firefox.

like image 30
Patrick Hammer Avatar answered Sep 30 '22 05:09

Patrick Hammer