Is it valid HTML to have an anchor tag without hre

2019-04-24 16:01发布

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条回答
等我变得足够好
2楼-- · 2019-04-24 16:46

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.

查看更多
登录 后发表回答