问题
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:
- It is forbidden by the HTML specification
- Some browsers will cause the link to break
- 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