HTML5有效表单输入/字段

no.*_*no. 2 forms markup html5 input

我对HTML5输入字段的有效标记有点困惑.

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Site Name</title>
</head>

<body>

    <form name="contact" method="post" action="/">
       <p><input type="input" name="first_name" maxlength="255" /></p>
    </form>

</body>

</html>
Run Code Online (Sandbox Code Playgroud)

当我通过w3.org上的验证器运行时,我得到错误Bad value input for attribute type on element input.,/>突出显示为红色.我看一下它创建的HTML-Tidy版本,它告诉我这样写它:

<p><input type="input" name="first_name" maxlength="255"></p>
Run Code Online (Sandbox Code Playgroud)

但是当我验证我然后得到相同的错误,但只有>突出显示为红色.然后查看HTML-Tidy以查看它已经纠正了它并且它离开的情况就像它可以正常一样,但错误仍然存​​在.这被认为是有效的HTML5标记吗?或者有一种特定的方法吗?

Veg*_*ger 5

type="input"是该属性的值无效type的的input元件.

input元素的这个指南显示了允许的type属性.或者,如果您需要其中一种,请检查HTML5 其他输入类型.

对于常规文本字段,您需要将type属性设置为type="text".