PRACTICAL WEB TIP
Dock / Return — Back to Top Button
A tactile, centered dock with a clear destination. Events, exhibitions and campaign pages with long-scroll content.
Design Preview
See the design above before trying the scroll interaction.
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.
<!-- TB-2055 / Dock / Return | paste before closing body -->
<button class="backtop tb-btt-button w2055" type="button" aria-label="Back to top"><span class="w55small">SCROLL</span><span class="w55divider"></span><span class="w55label">TOP</span><span class="w55arrow">↑</span></button>
/* TB-2055 / Dock / Return */
.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}
.w2055{left:50%;bottom:23px;transform:translate(-50%,12px);width:210px;height:53px;border:1px solid #bdd277;background:#171a19ed;color:#e2efab;display:flex;gap:13px;align-items:center;justify-content:center;box-shadow:0 12px 25px #0006;transition:opacity .25s,transform .3s}.w2055.is-visible{transform:translate(-50%,0)}.w55small{font:600 9px Arial,sans-serif;letter-spacing:.18em;color:#bfc5b7}.w55divider{height:22px;width:1px;background:#717b62}.w55label{font:750 14px Arial,sans-serif;letter-spacing:.15em}.w55arrow{font:400 27px Georgia,serif;transition:transform .3s}.w2055:hover .w55arrow{transform:translateY(-5px)}@media(max-width:430px){.w2055{width:178px}}
@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}}
.w2055{bottom:clamp(24px,5vh,55px);width:228px;height:57px;gap:14px;border:1px solid #d3e293;background:#1a211ef5;box-shadow:0 12px 30px #0008;}
.w2055 .w55small{letter-spacing:.2em;opacity:.65}.w2055 .w55label{font-size:13px;letter-spacing:.18em}.w2055 .w55arrow{font-size:20px;}
.w2055:hover{background:#304335;box-shadow:0 17px 33px #0009;transform:translate(-50%,-4px)}
@media(max-width:650px){.w2055{bottom:20px;width:190px;height:53px;gap:11px}}
(()=>{'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
Events, exhibitions and campaign pages with long-scroll content.
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.