Category: Software

Tags: PHP

In an HTML (php) page that is very long and a quick return to the top is required then a floating up arrow in the bottom right corner is called for. To achieve this add some CSS and a short piece of php.
Add near the bottom html page
<a href="#" class="back-to-top" aria-label="Back to top">
&uarr;
</a>

then add the following to your css file
/* Back to top button */

.back-to-top {
position: fixed;
bottom: 25px;
right: 25px;

width: 45px;
height: 45px;

background: #0078d4;
color: white;

border-radius: 50%;
border: none;

font-size: 24px;
line-height: 45px;
text-align: center;

text-decoration: none;

cursor: pointer;

box-shadow: 0 3px 8px rgba(0,0,0,0.4);

z-index: 1000;
}

.back-to-top:hover {
background: #005a9e;
color: white;
text-decoration: none;
}