Add links on buttons

How do i add a link on a button? so when they click the button it goes to another website

Simply wrap the <button> element in an <a> element.

If you are missing the “hand” cursor, you can add the css rule button { cursor : pointer; }

Example:

<style>
.btn {
	background: #08a;
	color: white;
	padding: 4px 16px;
	border: none;
	border-radius: 16px;
}
div {
	margin: 2em 0;
}
button {
	cursor: pointer;
}
</style>

<div>
    <a href="https://stegriff.co.uk"><button>Native button</button></a>
</div>

<div>
    <a href="https://stegriff.co.uk"><button class="btn">Styled button</button></a>
</div>

<button onclick=" window.location = 'https://example.com' ">Click me!</button>

u can just do a href="(link)" inside the buttons scripts

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.