TipsBlocks Web Technique Library

PRACTICAL WEB TIP

← Back to library

Fine Rail — Back to Top Button

A restrained vertical rail, with a generous tactile target. Architecture studios, portfolios and editorial layouts with generous margins.

Design Preview

See the design above before trying the scroll interaction.

LOOK CLOSELY
IN PAGE CONTEXT

Live Demo

Press Try scrolling inside the frame, or scroll inside it. The button appears at the lower right and returns you to the top.

Source Code

Copy the HTML, CSS or JavaScript you need for your project.

HTML
<!-- TB-2049 / Fine Rail | paste before closing body -->
<button class="backtop tb-btt-button w2049" type="button" aria-label="Back to top"><span class="w49track"><span class="w49arrow">↑</span><span class="w49type">PAGE TOP</span></span></button>
CSS
/* TB-2049 / Fine Rail */
.backtop{box-sizing:border-box;position:fixed;z-index:50;cursor:pointer;opacity:0;visibility:hidden;pointer-events:none;transform:translateY(12px);text-align:center;transition:opacity .24s, transform .28s, visibility .24s}.backtop.is-visible{opacity:1;visibility:visible;pointer-events:auto;transform:translateY(0)}.backtop.w2055.is-visible{transform:translate(-50%,0)}.backtop:focus-visible{outline:3px solid #e7ab4c;outline-offset:4px}
.w2049{right:24px;bottom:26px;width:49px;height:112px;border:1px solid #8a9688;background:#f4f4eee8;color:#38483b;box-shadow:0 8px 22px #121c1314;backdrop-filter:blur(12px)}.w49track{height:100%;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:15px}.w49arrow{font:300 25px/1 Georgia,serif;transition:transform .35s}.w49type{font:700 9px/1 Arial,sans-serif;letter-spacing:.18em;writing-mode:vertical-rl;transform:rotate(180deg)}.w2049:hover .w49arrow{transform:translateY(-6px)}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{transition-duration:.01ms!important;animation-duration:.01ms!important}}
/* POLISH PASS 2026-10-18: alignment, tactile size, emphasis & individual character */
.backtop{isolation:isolate;-webkit-tap-highlight-color:transparent;}
.backtop:focus-visible{outline:3px solid #f0af42;outline-offset:4px;}
@media(prefers-reduced-motion:reduce){.backtop,.backtop *{transition-duration:.01ms!important;animation-duration:.01ms!important}}

.w2049{right:clamp(16px,2.8vw,42px);bottom:clamp(24px,5.5vh,62px);width:52px;height:116px;border-color:#a5aea3;background:#f8f8f1f5;box-shadow:0 7px 25px #293e261b;}
.w2049 .w49track{height:100%;display:flex;flex-direction:column;align-items:center;justify-content:space-around;padding:11px 0;}
.w2049:hover{background:#354d3e;color:#fff;border-color:#354d3e;}
@media(max-width:650px){.w2049{right:18px;bottom:28px;height:104px;width:47px}}
JavaScript
(()=>{'use strict';const button=document.querySelector('.backtop');if(!button)return;const footerOnly=button.classList.contains('footer-backtop');const reduced=matchMedia('(prefers-reduced-motion: reduce)');let scheduled=false;function update(){scheduled=false;if(footerOnly)return;const shown=window.scrollY>160;button.classList.toggle('is-visible',shown);button.classList.toggle('is-hidden',!shown);button.tabIndex=shown?0:-1;button.setAttribute('aria-hidden',String(!shown));if(button.classList.contains('w2056')){const max=Math.max(1,document.documentElement.scrollHeight-innerHeight);button.style.setProperty('--progress',(Math.round(Math.min(100,scrollY/max*100)))+'%');}}function onScroll(){if(!scheduled){scheduled=true;requestAnimationFrame(update)}}button.addEventListener('click',()=>window.scrollTo({top:0,behavior:reduced.matches?'instant':'smooth'}));addEventListener('scroll',onScroll,{passive:true});addEventListener('resize',onScroll,{passive:true});update();})();

How to Use

Insert the HTML button near the end of body, load the CSS, and include JavaScript using defer. Test scrolling, returning to the top, and positioning on mobile.

Use Case

Architecture studios, portfolios and editorial layouts with generous margins.

Technical Notes

Keep controls usable on touch devices. Test keyboard focus and reduced-motion preferences.

Mobile:Check tap target and placement on mobile devices.

Browser:Test in your supported browsers.

Reduced Motion:CSS respects prefers-reduced-motion.