Any downside to putting a button inside of an anchor?

≯℡__Kan透↙ 提交于 2019-12-02 20:24:33

问题


I'm building a wordpress plugin to add FB, Twitter, and LinkedIn share buttons to a post. I know it's been done a hundred times, but it's good practice and I'm putting a spin on it. Are there any downsides to putting a button inside of an anchor tag like so?

<a href="#"><input type="submit" value="share to facebook" /></a>

Your thoughts are appreciated.


回答1:


  1. It is forbidden by the HTML specification
  2. Some browsers will cause the link to break
  3. Some browsers will cause the button to break

If you want a link that looks like a button, then use a link and apply CSS.

If you want a submit button, then don't put it inside a link.



来源:https://stackoverflow.com/questions/20261925/any-downside-to-putting-a-button-inside-of-an-anchor

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