1

I try to validate my code but the "The element button must not appear as a descendant of the a element" keeps showing and I have seriously no idea how to solve it, here is an example of how it looks. Thank you

<a href=#boats><button><img src="img/boats.png" alt="Boating"></button></a>
10 Rep
  • 2,217
  • 7
  • 19
  • 33
poni
  • 27
  • 3

2 Answers2

1

Certain elements aren't allowed inside <a> tags.

Check this SO post for a list of which ones: Can I nest a <button> element inside an <a> using HTML5?

Daniel_Knights
  • 7,940
  • 4
  • 21
  • 49
0

You should use only one of the button and a tags. You can create the same effect of the href in a button using some of the suggestions here.

Daniel Geffen
  • 1,777
  • 1
  • 11
  • 16