开发者

Is this a valid HTML disabled tag? <input .... disabled/>

i came across this HTML tag which has a disabled optional attribute "disabled", however it seem to have worked for a long t开发者_C百科ime in IE6 environment, it looks like it is not declared correctly.

 <input name="selectBoltonButton" type="Submit" value="Select Bolt-Ons "  disabled>

Ideally, it should look something like this: according to w3schools:

 <input name="selectBoltonButton" type="Submit" value="Select Bolt-Ons "  disabled="disabled">


They're both valid HTML, while only the latter is valid XHTML. SGML allows this, and so do its HTML children, where this is called a "boolean attribute". HTML5 retains this concept.

XHTML, on the other hand, is a dialect of XML, which has a restriction that all attributes must have values.


Who really cares whether it's "valid", it will have zero impact on anything.

That said, the SGML declaration used by HTML 4.01 allows attribute minimization, whereas the XML SGML declaration (used by XHTML) does not (FEATURES MINIMIZE ATTRIB VALUE NO). So take your pick.

If you're one of these modern HTML5-Web2.0 people, then none of the above will be relevant to you and you probably just write disabled.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜