<按钮>与 <input type="button" 对比/>.使用哪个? [英] <button> vs. <input type="button" />. Which to use?
本文介绍了<按钮>与 <input type="button" 对比/>.使用哪个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在查看大多数网站(包括 SO)时,大多数都使用:
When looking at most sites (including SO), most of them use:
<input type="button" />
代替:
<button></button>
- 两者之间的主要区别是什么(如果有的话)?
- 是否有正当理由使用一个而不是另一个?
- 是否有充分的理由来使用它们?
- 使用
<button>
是否会带来兼容性问题,看到它的使用不是很广泛? - What are the main differences between the two, if any?
- Are there valid reasons to use one instead of the other?
- Are there valid reasons to use combine them?
- Does using
<button>
come with compatibility issues, seeing it is not very widely used? - 这是一个页面 描述差异(基本上你可以将 html 放入
<button></button>
) - 还有另一页描述人们为什么避免使用
<按钮></button>
(提示:IE6) - Here's a page describing the differences (basically you can put html into a
<button></button>
) - And another page describing why people avoid
<button></button>
(Hint: IE6)
推荐答案
使用时的另一个IE问题:
Another IE problem when using <button />
:
当我们谈论 IE 时,它是有几个与此相关的错误按钮的宽度.它会神秘地尝试时添加额外的填充添加样式,这意味着您必须添加一个小技巧,让事情变得更糟控制.
And while we're talking about IE, it's got a couple of bugs related to the width of buttons. It'll mysteriously add extra padding when you're trying to add styles, meaning you have to add a tiny hack to get things under control.
这篇关于<按钮>与 <input type="button" 对比/>.使用哪个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文