Ready-to-use snippets for your development.
Basic structure for a custom card.
<div class="card h-100 border-0 shadow-sm" style="border-radius: 1.5rem;">
<div class="card-body">
<h5 class="card-title fw-bold">Card Title</h5>
<p class="card-text text-muted">Some example text.</p>
<a href="#" class="btn btn-gradient-pink rounded-pill">Go somewhere</a>
</div>
</div>
How we style the gradient buttons.
.btn-gradient-pink {
background: linear-gradient(90deg, #ff6b6b, #ff8e8e);
color: white;
border: none;
border-radius: 50rem;
padding: 0.5rem 1.5rem;
transition: all 0.3s ease;
}
.btn-gradient-pink:hover {
background: linear-gradient(90deg, darken(#ff6b6b, 5%), darken(#ff8e8e, 5%));
color: white;
transform: translateY(-2px);
}
Example of the "Go to Top" button logic.
// Get the button
let mybutton = document.getElementById("goToTopBtn");
// When the user scrolls down 20px from the top of the document, show the button
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
mybutton.classList.remove("d-none");
} else {
mybutton.classList.add("d-none");
}
}
// When the user clicks on the button, scroll to the top of the document
mybutton.addEventListener("click", function(){
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
});