PRACTICAL WEB TIP
Editorial Masthead — First Page
Large editorial typography returns the visitor to the opening of the story.
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-2063 / Editorial Masthead / 大きな書体 | paste before the closing body tag (inside the footer for TB-2069) -->
<button aria-label="ページの先頭へ戻る" class="btt editorial tb-btt-2063" type="button"><span class="ed-rule"></span><span class="ed-big">FIRST<br/>PAGE</span><span class="ed-small">↶ begin again</span></button>
/* 2063 / production button rules only */
.tb-btt-2063{box-sizing:border-box;font:inherit;cursor:pointer}.tb-btt-2063 :is(span,i,em,b,small,img){box-sizing:border-box}
.btt.tb-btt-2063{position:fixed;z-index:90;border:0;cursor:pointer;-webkit-tap-highlight-color:transparent;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .28s ease,visibility .28s ease,transform .35s ease}.btt.tb-btt-2063:focus-visible{outline:3px solid #f0af43;outline-offset:5px}.tb-btt-2063 .editorial{left:0;top:48%;width:119px;min-height:164px;background:#171717;color:white;transform:translateX(-74px);text-align:right;padding:18px 12px 15px 16px;border-right:7px solid #e2a64f;transition:opacity .28s,visibility .28s,transform .4s}.tb-btt-2063 .ed-rule{display:block;height:1px;background:#a5a49f;margin-bottom:14px}.tb-btt-2063 .ed-big{font:500 27px/.92 Georgia,serif;letter-spacing:-.05em}.tb-btt-2063 .ed-small{display:block;font:400 9px/1.3 Georgia,serif;margin-top:19px;letter-spacing:.01em;color:#e8c99c}.tb-btt-2063 .editorial:hover{width:132px;background:#2d2a26}@media (max-width:600px){.tb-btt-2063 .editorial{top:auto;bottom:28px;width:92px;min-height:123px;padding:12px 9px}.tb-btt-2063 .ed-big{font-size:21px}.tb-btt-2063 .ed-small{font-size:8px;margin-top:12px}}
@media(prefers-reduced-motion:reduce){.tb-btt-2063,.tb-btt-2063 *{animation-duration:.01ms!important;transition-duration:.01ms!important}}
(()=>{'use strict';const target=document.querySelector('.btt, .footer-return');if(!target)return;const isFooter=target.classList.contains('footer-return');const reduced=matchMedia('(prefers-reduced-motion: reduce)');let active=false;const update=()=>{const y=window.scrollY;const p=Math.max(0,Math.min(1,y/Math.max(1,document.documentElement.scrollHeight-innerHeight)));if(!isFooter){const visible=y>160;target.classList.toggle('is-visible',visible);target.setAttribute('aria-hidden',String(!visible));target.tabIndex=visible?0:-1;}target.style.setProperty('--pct',p.toFixed(3));const txt=target.querySelector('[data-progress]');if(txt)txt.textContent=String(Math.round(100*p)).padStart(2,'0')+'%';};const scroll=()=>{if(active)return;active=true;requestAnimationFrame(()=>{active=false;update()})};target.addEventListener('click',()=>window.scrollTo({top:0,behavior:reduced.matches?'instant':'smooth'}));addEventListener('scroll',scroll,{passive:true});addEventListener('resize',scroll,{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
Editorial magazines, culture journals and portfolios.
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.