KingRichard
KingRichard

Reputation: 1244

Any downside to putting a button inside of an anchor?

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.

Upvotes: 1

Views: 201

Answers (1)

Quentin
Quentin

Reputation: 944441

  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.

Upvotes: 2

Related Questions