Html 你如何在 HTML5 中制作提交按钮?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4139975/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 05:11:19  来源:igfitidea点击:

How do you make a submit button in HTML5?

htmlinputsubmitelementmarkup

提问by ma11hew28

Given W3C's HTML5 spec for the submit button:

鉴于提交按钮的 W3C 的 HTML5 规范

A button element must have both a start tag and an end tag.

按钮元素必须同时具有开始标记和结束标记。

what's an example of a submit button with a start and end tag?

带有开始和结束标记的提交按钮的示例是什么?

  1. <button type="submit">
  2. <button type="submit" />
  3. <button type="submit" ></button>
  4. 2 & 3
  5. None of the above
  1. <button type="submit">
  2. <button type="submit" />
  3. <button type="submit" ></button>
  4. 2 & 3
  5. 以上都不是

Is the answer the same for other "singleton" tags, like <input>or <img>?

其他“单例”标签的答案是否相同,例如<input><img>

回答by Gert Grenander

<button type="submit">Click me</button>

W3Cand MDNhas more information.

W3CMDN有更多信息。