开发者

How do I vertically align text in an input field in Firefox?

开发者 https://www.devze.com 2023-01-02 11:09 出处:网络
Using this code firefox 3.5.9 will display input text in the top part of the input field. Safari and Opera will center it.

Using this code firefox 3.5.9 will display input text in the top part of the input field. Safari and Opera will center it.

How do I make Firefox align the text like the other two browsers?

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <title>Test</title>
    <style type="text/css">
        #q {
            padding:0;
            height: 30px;
            font-size:18px;
            line-height:20px;
        }
    </sty开发者_JS百科le>
</head>
<body>
<input type="text" value="Text alignment" id="q">    
</body>
</html>  


forget the height and just set padding to give the height you are after.

0

精彩评论

暂无评论...
验证码 换一张
取 消