我正在使用一些使用框架的古老网络应用程序。有一个属性 <frame>
称为 noresize
, 其值只能指定为 "noresize"
.我在代码中注意到 noresize
没有赋值:
<frame name="client_search_banner" src="pdc?page=client_search_banner.htm" noresize scrolling="no">
起初我以为noresize scrolling
是一个属性,但从我读过的所有内容来看,它们似乎是两个完全不同的东西。我想知道在这种情况下是否假定该值,因为只有一个可能的值。有人可以确认一下吗?
最佳答案
在 HTML 4.01 及更早版本中,you can omit everything except the attribute value .
在 XHTML 中,you cannot omit anything .
在 HTML 5 和更新版本中,you can omit everything except the attribute name .
由于 HTML 中 bool 属性的名称和值始终相同,因此 HTML 4 和 5 规则实际上是相同的。
关于html - 对于只有一个可能取值的 HTML 属性,是否可以省略取值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23697069/