'Button as a Link
I want to know what is the difference between both codes , the first isn't working while the second is working properly , so what causes this .Help appreciated.
<a href="https://www.google.com" target="_blank">
<button> Next </button>
</a>
<button>
<a href="https://www.google.com" target="_blank">
Next Page
</a>
</button>
Solution 1:[1]
Both are invalid. HTML does not allow links to contain buttons or vice versa.
The error handling routines in browsers are just different for the two cases.
If you want a link that looks like a button then use a link and apply CSS.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Quentin |
