Link Buttons Tutorial

Getting a simple button with your referral link is super easy.

Simple one line of basic HTML code.

Replace STAR-XXXX-XXXX with your referral code.

<a href="https://robertsspaceindustries.com?referral=STAR-XXXX-XXXX" target="_blank"><button id="referralButton" type="button">STAR-XXXX-XXXX</button></a>

This button uses JavaScript and opens up more possibilities to improve user experience and capabilties.

Replace STAR-XXXX-XXXX with your referral code.

<button id="referralButton" type="button">STAR-XXXX-XXXX</button>
<script>
document.getElementById('referralButton').addEventListener('click', function() {
    window.open('https://robertsspaceindustries.com?referral=STAR-XXXX-XXXX', '_blank');
});
</script>

Read more about DOM Event Listeners here.

Use this code along with your simple or advanced button elements to create compelling styles that match your site color scheme.

button#referralButton { /* This targets just your referralButton */
    background-color: #4682b4;
}
button { /* This is for all button elements */
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    background-color: #008CBA; /* Change to your preferred color */
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
button:hover { /*Mouse Over */
    background-color: #007B9A;
}
button:active { /*Mouse Click*/
    background-color: #005F73;
}

Read more about how to customize CSS Buttons here.

Last updated