HTML - Why boolean attributes do not have boolean value?

前端 未结 7 888
小蘑菇
小蘑菇 2020-12-03 10:41

I noticed that some elements have attributes which are boolean. I wonder why the values are not true or false? or 1 and 0? Are there any reason behind why they are like this

7条回答
  •  余生分开走
    2020-12-03 10:59

    Readability, a lot of HTML is not coded by people with computer science backgrounds so the concept of "Boolean" would be foreign to them in those terms. Also it improves readability for Computer Science and other technical users by providing reinforced clues as to the function of a given statement.

提交回复
热议问题