Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Firefox cutting off the text in my <input type="text"/>?

Tags:

html

css

layout

I have a simple <input type="text"/> styled with the following:

font-size:1.5em;line-height:1.5em;padding:.6em .4em;

It displays perfectly normally in Chrome, Safari (i.e. Webkit browsers).

However, we arrive at Firefox, and this happens:

Why is this happening? Gah!

As you can see, Firefox decides to cut off the size of the font at a certain height. Why is this happening? This problem occurs even if I remove the padding from the <input>.

Note:

It might help to know that the additional styles applied to this input are the default styles used in Twitter Bootstrap v.2.0.

Here's a JSFiddle, with the exact problem I'm describing:

http://jsfiddle.net/xxepX/

like image 428
element119 Avatar asked Mar 28 '12 01:03

element119


2 Answers

Try increasing your line height property. That would be restricting the viewable area for the letters causing them to be cut off. Firefox's rendering engine renders line height slightly different.

like image 91
KodeKreachor Avatar answered Oct 20 '22 20:10

KodeKreachor


This helped me in a similar case:

input.with-fancy-styling {
    box-sizing: content-box;
}
like image 43
Filip Górny Avatar answered Oct 20 '22 19:10

Filip Górny