Why is it not ok doing <button> <a href=link> content </a> </button> ? | Sololearn: Learn to code for FREE!


Why is it not ok doing <button> <a href=link> content </a> </button> ?

hey so ive been doing few buttons for my website and when using a code validator it told me that this typo was not ok, so I instead went for : <form action=https://projetdemorgan.neocities.org/biographie.html> <input class=boutons2categ type=submit value="Autobiographie"> </form> but it made me wonder why it's not ok doing as first planned to ? it's working as intended in both ways, so that made me curious thanks

12/2/2019 4:54:32 AM


3 Answers

New Answer


welcome Morgan


first off the hyperlink would only work on the text inside the button as a standard hyperlink and therefore the button tags won't work properly the button tags go on the inside of the hyperlink causing the buttons to appear clicked on... <a href="https://projetdemorgan.neocities.org/biographie.html"><button>Biography</button></a>


Thanks for explaining