webkit浏览器中输入元素的垂直填充不起作用 [英] vertical padding for input elements in webkit browsers has no effect

查看:158
本文介绍了webkit浏览器中输入元素的垂直填充不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



下面的代码可以在IE / Firefox / Opera中使用,但是在IE / Firefox / Opera中可以使用,但是在输入元素中我们无法为文本/占位符设置垂直/顶部填充。不在Safari / Chrome中:



CSS:

  input 
{
border:1px纯黑色;
height:100px;
padding:70px 25px 10px 25px;
width:300px;
}

HTML:

 < input type =textplaceholder =在此处输入文字/> 

webkit Developer Tools按照它们应该显示的指标,但文本仍然处于输入。



类似的可能是(未答复,但)。

我相信没有

使用 height 属性添加垂直填充。您可能需要使用 line-height padding-top / padding-bottom 在浏览器中纵向放置文本。


I am unable to set a vertical/top padding for the text/placeholder in input elements.

The following code will work in IE/Firefox/Opera, but not in Safari/Chrome:

CSS:

input
{
 border: 1px solid black;
 height: 100px;
 padding: 70px 25px 10px 25px;
 width: 300px;
}

HTML:

<input type="text" placeholder="Enter text here"/>

The webkit Developer Tools display the metrics as they should be, but the text is still in the middle of the input.

Something similar might be here (unanswered though).

解决方案

I believe there is no way to set vertical padding in Webkit.

Use the height property, to add vertical padding. You may need to use line-height or padding-top/padding-bottom to vertically center the text across browsers.

这篇关于webkit浏览器中输入元素的垂直填充不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆