PRACTICAL WEB TIP
Letterhead Return — Back to First Line
An opening envelope in the footer returns readers to the first line.
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.
<button aria-label="ページの先頭、手紙の書き出しへ戻る" class="btt-control btt-2096" data-btt="" type="button"><span aria-hidden="true" class="letter-envelope"><i></i></span><span class="letter-ink"><small>RETURN TO THE BEGINNING</small><b>書き出しへ</b><em>Back to top</em></span><span aria-hidden="true" class="letter-seal">✳</span></button>
.btt-control{box-sizing:border-box;appearance:none;cursor:pointer;user-select:none;-webkit-tap-highlight-color:transparent}.btt-control:focus-visible{outline:3px solid #e6a643;outline-offset:5px}.btt-hidden{opacity:0;visibility:hidden;pointer-events:none}.btt-visible{opacity:1;visibility:visible;pointer-events:auto} @media(prefers-reduced-motion:reduce){.btt-control,.btt-control *{animation-duration:.01ms!important;transition-duration:.01ms!important}}
.btt-2096{position:absolute;right:clamp(24px,5vw,82px);bottom:85px;z-index:4;width:222px;min-height:134px;border:1px solid #cbbca8;background:#fff9ef;color:#544339;box-shadow:0 15px 27px #a6958233;padding:18px 14px 12px;display:flex;align-items:end;text-align:left;gap:12px;transition:transform .3s,box-shadow .3s}.letter-envelope{display:block;position:relative;flex:none;width:60px;height:50px;background:#eadac6;border:1px solid #b79c80;box-shadow:0 3px 6px #0001;overflow:hidden}.letter-envelope:before{content:'';position:absolute;top:-1px;left:-1px;width:calc(100% + 2px);height:90%;clip-path:polygon(0 0,100% 0,50% 70%);background:#d9c5ab;transform-origin:top;transition:transform .4s}.letter-envelope i{position:absolute;bottom:0;left:0;right:0;height:70%;background:linear-gradient(145deg,#dbc7ac 50%,transparent 50%),linear-gradient(215deg,#dbc7ac 50%,transparent 50%);background-size:50% 100%;background-repeat:no-repeat;background-position:left,right}.letter-ink{min-width:0;display:flex;flex-direction:column;gap:5px}.letter-ink small{font:700 7.8px/1.4 Arial;letter-spacing:.07em;color:#7a7166}.letter-ink b{font:500 17px/1.3 'Noto Serif CJK JP',serif;white-space:nowrap}.letter-ink em{font:italic 14px Georgia,serif;color:#856b57}.letter-seal{position:absolute;top:6px;right:12px;color:#b88f7b;font:22px Georgia;animation:sealBreath 4.8s ease-in-out infinite}.btt-2096:hover{transform:translateY(-7px);box-shadow:0 20px 32px #a6958255}.btt-2096:hover .letter-envelope:before{transform:rotateX(55deg)}@keyframes sealBreath{0%,100%{opacity:.6}50%{opacity:1}}@media(max-width:700px){.btt-2096{bottom:48px;right:16px;width:206px;min-height:120px;padding:14px 12px}.letter-envelope{width:52px;height:46px}.letter-ink b{font-size:16px}}
(()=>{'use strict';const el=document.querySelector('[data-btt]');if(!el)return;const footerOnly=true;const reduce=window.matchMedia('(prefers-reduced-motion: reduce)');let raf=0;function update(){raf=0;const p=Math.max(0,Math.min(1,window.scrollY/Math.max(1,document.documentElement.scrollHeight-window.innerHeight)));if(!footerOnly){const shown=window.scrollY>170;el.classList.toggle('btt-visible',shown);el.classList.toggle('btt-hidden',!shown);el.tabIndex=shown?0:-1;el.setAttribute('aria-hidden',String(!shown));}el.style.setProperty('--progress',p.toFixed(3));const field=el.querySelector('[data-state]');}function onScroll(){if(!raf)raf=requestAnimationFrame(update)}window.addEventListener('scroll',onScroll,{passive:true});window.addEventListener('resize',onScroll,{passive:true});el.addEventListener('click',()=>{el.classList.add('is-going');window.scrollTo({top:0,behavior:reduce.matches?'auto':'smooth'});window.setTimeout(()=>el.classList.remove('is-going'),650)});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
Stationery, stories and wedding sites.
Technical Notes
Keep controls usable on touch devices. Test keyboard focus and reduced-motion preferences.
Mobile:Check tap target, visibility and positioning on small screens.
Browser:Designed for current Chrome, Edge, Firefox and Safari.
Reduced Motion:CSS animations respect the reduced-motion preference.