HTML5:它是自动对焦=“自动对焦”或自动对焦 [英] HTML5: is it autofocus="autofocus" or autofocus
问题描述
我似乎想起以前版本的HTML(在HTML5之前)所需的属性中的大多数(也许是全部)属性具有值,如 readonly =readonly
p>
这对HTML5和 autofocus
属性是否正确?
在HTML中,您可以根据需要使用带或不带值的布尔属性。
对于W3C来说,像自动对焦一样的布尔值可以像 autofocus
或 autofocus =autofocus
或 autofocus =
。
如果您不想自动对焦,请不要写下它。 / p>
我认为你很困惑,因为XHTML需要所有属性的值: attributes =values
。
以下是关于HTML中布尔属性使用的一些信息:
http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#boolean-attribute
I seem to recall most (maybe all) attributes in previously versions of HTML (before HTML5) required attributes to have values, like readonly="readonly"
.
Is this true for HTML5 and the autofocus
attribute?
In HTML, you use boolean attributes with or without values as you like.
A boolean, for W3C, like autofocus can be written like that autofocus
or autofocus="autofocus"
or also autofocus=""
.
If you don't want autofocus just don't write it.
I think you are confused because XHTML requires values for all attributes: attributes="values"
.
Here is some information about boolean attribute use in HTML: http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#boolean-attribute
这篇关于HTML5:它是自动对焦=“自动对焦”或自动对焦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!