gpt4 book ai didi

dom - boolean属性应该怎么写?

转载 作者:搜寻专家 更新时间:2023-10-31 08:06:30 26 4
gpt4 key购买 nike

<分区>

我一直在阅读一些关于 HTML、XHTML 等的文章。其中大部分(即 My preferred syntax style)都说 boolean 属性应该不带任何值,如下所示:

<input type="text" required>

他们甚至说像这样使用这个属性是错误的:

<input type="text" required="required">

部分文章链接W3其中说:

If the attribute is present, its value must either be the empty string or a value that is an ASCII case-insensitive match for the attribute's canonical name, with no leading or trailing whitespace.

但在示例中显示如下:

Here is an example of a checkbox that is checked and disabled. The checked and disabled attributes are the boolean attributes.

<label><input type=checkbox checked name=cheese disabled>Cheese</label>

This could be equivalently written as this:

<label><input type=checkbox checked=checked name=cheese disabled=disabled> Cheese</label>

You can also mix styles; the following is still equivalent:

<label><input type='checkbox' checked name=cheese disabled="">Cheese</label>

那么,boolean属性应该怎么写呢?根据您的经验,哪些选项是跨浏览器的,哪些不是?

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com