Is it correct to use single quotes for HTML attributes?

前端 未结 15 2715
没有蜡笔的小新
没有蜡笔的小新 2020-12-01 05:57

Recently I\'ve been seeing a lot of this:


    

        
15条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-01 06:30

    You should avoid quotes altogether.

    In your example only one quoted attribute actually needed quotes.

    
    
      Ross's Widget
    
    

    If you do use quotes, there is no hard and fast rule, but I've seen most commonly single quotes, with double quotes on the inside if necessary.

    Using double quotes won't pass some validators.

提交回复
热议问题