HTML5:它是自动对焦=“自动对焦”或自动对焦 [英] HTML5: is it autofocus="autofocus" or autofocus

查看:114
本文介绍了HTML5:它是自动对焦=“自动对焦”或自动对焦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎想起以前版本的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆