<按钮和GT;与<输入类型=”按钮" /取代。它使用?
问题描述:
在看大多数网站(包括SO),他们大多是:
When looking at most sites (including SO), most of them use:
<input type="button" />
而不是:
<button></button>
- 什么是两者之间的主要区别,如果有的话?
- 有没有使用有效的原因之一,而不是其他?
- 是否有使用结合他们的正当理由?
- 使用是否
&LT;按钮和GT;
配有兼容问题,看它是不是很广泛的应用 - 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?
答
- Here's一个页面描述差异(基本上你可以把HTML成
&LT;按钮和GT;&LT; /按钮&GT;
) - 和另一页面描述为什么人们避免
&LT;按钮和GT ;&LT; /按钮&GT;
(提示:IE6)
- Here's a page describing the differences (basically you can put html into a
<button></button>
) - And an other page describing why people avoid
<button></button>
(Hint: IE6)
另一个IE的问题&LT;按钮/&GT;
:
虽然我们谈论的IE浏览器,它的
有一对夫妇的bug有关
按钮的宽度。它会神不知鬼不觉
加上微胖,当你试图
添加的样式,这意味着你必须添加
一个微小的黑客要得到的东西
控制。
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.