为什么我们要在html输入标签属性值中使用双引号?

时间:2015-04-06 13:19:36

标签: html attributes double-quotes

请解释这两行之间的区别:

 <input type="text" size="10" maxlength="10" name="zip" value="95131" /> 

 <input type=text size=10 maxlength=10 name=zip value=95131 />

两者都渲染。

使用双引号(“)有什么好处/缺点?

1 个答案:

答案 0 :(得分:0)

http://www.w3schools.com/html/html_attributes.asp

摘自链接:

  

我们建议:始终引用属性值

     

HTML5标准不需要围绕属性值的引号。

     

W3C 建议引用HTML4,要求引用更严格的文档类型,如XHTML。

     

有时使用引号必要