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

0

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

Morgan

3 Answers

New Answer

+2

welcome Morgan

+1

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>

+1

Thanks for explaining