本文介绍了应该如何布尔属性来写的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在阅读有关HTML,XHTML等一些文章在大多数人(即)说,布尔属性应该没有任何值被写入,这样的:

 <输入类型=文本要求>

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

 <输入类型=文本要求=需要>

一些这方面的文章的链接它说

but in the examples shows like this:

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

So, how should the boolean attributes be written? Based in your experience, which of the options are cross-browser and which are not?

解决方案

Attribues without values are valid in HTML, but invalid in XHTML, because it's not allowed in XML. Perhaps that's where your confusion is coming from. So, which one is valid depends on the doctype of your document.

这篇关于应该如何布尔属性来写的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 17:58