如何在Webkit浏览器中设置按钮(输入元素)的高度? [英] How to set the height of an button (input-element) on webkit browsers?
问题描述
在装有webkit浏览器的Mac(Safari和Chrome,当前版本)上,我无法设置输入元素的高度.
On my Mac with webkit-browsers (Safari and Chrome, current version) I can't set the height of an input-element.
<input type="button" style="height:200px;" value="Hello World!">
不起作用.
jQuerys $('input').css('height','200px');
也不起作用.
jQuerys $('input').css('height','200px');
won't work either.
尽管可以通过style-attribute或jQuery设置宽度.
Though setting the width is possible, either with style-attribute or with jQuery.
这种不一致的原因是什么?可能的解决方案是什么?
What is the reason for this inconsistency? And what is a possible solution?
推荐答案
显示内联块不执行任何操作,因为输入已默认设置了该显示.添加border:none
.当您这样做时,它开始表现出您想要的样子.这是小提琴-> http://jsfiddle.net/joplomacedo/XmS6m/1/
Display inline-block does nothing, as inputs already have that display set by default. Add border:none
. When you do so, it starts behaving like you want it to. Here's the fiddle -> http://jsfiddle.net/joplomacedo/XmS6m/1/
这篇关于如何在Webkit浏览器中设置按钮(输入元素)的高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!