To create an HTML button that acts like a link, you can use the <button>
element and attach an onclick
event to navigate to a URL.
Example:
- Explanation: The
window.location.href
changes the page’s URL, effectively acting as a link when the button is clicked.
Alternatively, use a styled <a>
tag with button-like styling:
With CSS: