Is it valid HTML to have an anchor tag without href and without name?

守給你的承諾、 提交于 2019-12-22 04:34:21

问题


Is it valid HTML to have an anchor tag without href and without name? In our app we have some delete links which are disabled (hence no href attribute), but still shown to the user.


I am posting this question on behalf of Joshua Muheim which was asked in the comments of a related question. It is very similar to the original question, but different enough that I felt it was worthwhile to open it as a separate question.


回答1:


Yes it's valid, the HTML spec says:

If the a element has no href attribute, then the element represents a placeholder for where a link might otherwise have been placed, if it had been relevant, consisting of just the element's contents.



来源:https://stackoverflow.com/questions/16302694/is-it-valid-html-to-have-an-anchor-tag-without-href-and-without-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!