Why do we need disabled=“disabled”?

前端 未结 4 907
走了就别回头了
走了就别回头了 2020-12-09 02:02

It seems to be common consensus that for XHTML attributes which do not require any value, we should repeat the attribute name. E.g. in co

4条回答
  •  旧巷少年郎
    2020-12-09 02:54

    There is documentation for this, the official term for these kind of attributes is "Boolean Attributes"

    The official standard is on the W3C website http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.3.4.2

    It says that:

    Their appearance in the start tag of an element implies that the value of the attribute is "true". Their absence implies a value of "false".

    For your XHTML mark-up to be valid, you must use the long-hand

    For HTML, you can use the minimised form

提交回复
热议问题