Is it correct to use single quotes for HTML attributes?

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

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


    

        
15条回答
  •  难免孤独
    2020-12-01 06:27

    Single quotes are perfectly legal in (X)HTML. Using a backslash to escape them, on the other hand, isn't. Ross\ is an image with the alt text "Ross\", and empty s and Widget/Widget' attributes. The correct way of escaping an apostrophe in HTML is '.

提交回复
热议问题