Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <html>
  <head>
    
  </head>
  <body>
    <!--   Content   -->
    <div class="content">
      <p>Lorem ipsum dolor sit amet, mei tacimates nominati ad, no possim tritani ponderum qui. Sed eirmod consectetuer in. Mei ei labores imperdiet, eu quo posse conceptam, vim viris nobis cu. Consul commodo omittantur in eos, ea everti facilisis per. Cum eu mazim diceret suavitate, est et aeque saperet persecuti, ei pertinax expetendis sed.
        </p>
        <p>
      Has eu noster probatus aliquando, eam an esse posse essent. Vix euismod ocurreret ut, munere comprehensam usu in, vix te viris nemore ocurreret. Legere dissentiet duo at, eu vix percipit urbanitas, et sed disputando comprehensam vituperatoribus. Te mei eius atqui facer, audire feugiat voluptatibus id eam. Et sensibus partiendo vix, vis ex nonumy soleat praesent.
        </p>
        <p>
      Nonumy placerat an mel, amet fabellas cu vim. Duo meis deserunt honestatis ne. Elitr efficiendi concludaturque cu cum, illud oblique splendide eu usu, atqui iusto nominavi sea ut. Te choro civibus his.
        </p>
        <p>Lorem ipsum dolor sit amet, mei tacimates nominati ad, no possim tritani ponderum qui. Sed eirmod consectetuer in. Mei ei labores imperdiet, eu quo posse conceptam, vim viris nobis cu. Consul commodo omittantur in eos, ea everti facilisis per. Cum eu mazim diceret suavitate, est et aeque saperet persecuti, ei pertinax expetendis sed.
        </p>
        <p>
      Vix quidam integre maiorum ea, dico omnesque oporteat ea nec, eius constituam in eum. Id sea legere incorrupte. Mei facer homero facete eu, vide impedit detracto ex vix. Alia assueverit ad vel, habeo similique cu sea, elit tractatos constituto id mel. Et ius hendrerit urbanitas, et eos magna mutat.
        </p>
        <p>
      Ei libris suscipit eum. Cu his autem viris similique. Vix simul ancillae ei, errem graeco appareat an ius. Pro ad ocurreret torquatos. Vim propriae intellegebat id.
        </p>
        <p>Lorem ipsum dolor sit amet, mei tacimates nominati ad, no possim tritani ponderum qui. Sed eirmod consectetuer in. Mei ei labores imperdiet, eu quo posse conceptam, vim viris nobis cu. Consul commodo omittantur in eos, ea everti facilisis per. Cum eu mazim diceret suavitate, est et aeque saperet persecuti, ei pertinax expetendis sed.
        </p>
        <p>
      Eam iusto periculis inciderint in, eum at veniam sensibus. Cum viderer euripidis rationibus id, eam cu prompta atomorum. Nam te evertitur adversarium, aperiri epicurei ea vis, in partem diceret invenire duo. Eu vel aeterno qualisque. Nam no reque augue.
        </p>
        <p>
      Enim duis veniam ius id, mea velit volutpat adolescens ei. Instructior disputationi mei ne. Facete corrumpit intellegebat an sit, ne pri sint facilis, duo fugit deterruisset et. Duo ne libris regione. Pri in iisque noluisse. Facete impedit invenire et eam, at tale debitis qui.
        </p>
        <p>
      At nam mutat impetus, at eos viris dolore euripidis. Molestie iudicabit at vim, pri everti bonorum dolores ut. Erat debet habemus usu in, duo ex probatus sententiae, id erant diceret disputando ius. Feugait lucilius deterruisset sit ad, vel unum aeque definiebas at. Diam phaedrum vituperatoribus ea per, cu qui debet facilisi conceptam, pri te tantas graeco utamur.
        </p>
        <p>
      His at elit graeco pericula, pro eu novum ludus, nec an idque tractatos. Feugiat utroque definitiones vix ei, ei mea purto prima delectus. Suas tota at per, his in ponderum salutatus. Nemore admodum omnesque sit ut, cu meliore epicurei vix. Legendos periculis mediocritatem vim no, sale persius vix no. Erant semper omnesque et vim, no mei velit senserit, partem nonumes senserit sed ea. Nibh quaeque scribentur no per, eu duo facer singulis.
        </p>
        <p>
      Et per tritani democritum, quod nisl honestatis et eum. Vis ei legere electram complectitur, ei est quem atomorum. Has ne tota corrumpit forensibus. Magna ornatus intellegebat ex sed.
        </p>
        <p>Lorem ipsum dolor sit amet, mei tacimates nominati ad, no possim tritani ponderum qui. Sed eirmod consectetuer in. Mei ei labores imperdiet, eu quo posse conceptam, vim viris nobis cu. Consul commodo omittantur in eos, ea everti facilisis per. Cum eu mazim diceret suavitate, est et aeque saperet persecuti, ei pertinax expetendis sed.
        </p>
        <p>
      Corpora omittam vivendum at est. Qui quod eleifend ut, te nam facilis epicurei antiopam. Usu possim intellegebat ea. Duo eu incorrupte complectitur vituperatoribus, eros sensibus vim ne. Ei sumo mutat fuisset vis.
        </p>
        <p>
      Has no simul dissentias. Eum an quas apeirian eloquentiam, iuvaret vocibus denique cu his. Dicta quodsi cu duo, falli feugiat legimus pro ei, te sale putant latine ius. Vix ex error labores scripserit. No pri laoreet accusata voluptaria.
        </p>
        <p>
      Usu ex aliquam graecis docendi. Mel scripta fabulas admodum ei, probo legimus definiebas an cum. Mel probo impetus mandamus id, aperiam mediocrem at sit, option atomorum mea an. Mazim dictas percipitur ex pri, usu et justo munere saperet.
      </p>
    </div>
    
    
    <!--   Scroll Top   -->
    <button class="btn-toggle-round scroll-top js-scroll-top" type="button" title="Scroll to top">
      <svg class="progress-circle" width="100%" height="100%" viewBox="-1 -1 102 102">
        <path d="M50,1 a49,49 0 0,1 0,98 a49,49 0 0,1 0,-98"/>
      </svg>
      <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-arrow-up" width="24" height="24" viewBox="0 0 24 24" stroke-width="1.5" stroke="cuurentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
        <path stroke="none" d="M0 0h24v24H0z" fill="none"/>
        <line x1="12" y1="5" x2="12" y2="19" />
        <line x1="18" y1="11" x2="12" y2="5" />
        <line x1="6" y1="11" x2="12" y2="5" />
      </svg>
    </button>
  </body>
</html>
              
            
!

CSS

              
                .scroll-top {
  --ghost-accent-color: royalblue;
	position: fixed;
  z-index: 50;
  padding: 0;
	right: 20px;
	bottom: 20px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(15px);    
	height: 46px;
	width: 46px;
	cursor: pointer;
	display: flex;
  align-items: center;
  justify-content: center;
	border-radius: 50%;
  transition: all .4s ease;
  border: none;
  box-shadow: inset 0 0 0 2px #ccc;
  color: #ccc;
  background-color: #fff;
}

.scroll-top.is-active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top .icon-tabler-arrow-up {
  position: absolute;
  stroke-width: 2px;
  stroke: #333;
}

.scroll-top svg path { 
	fill: none; 
}

.scroll-top svg.progress-circle path {
	stroke: #333;
	stroke-width: 4;
  transition: all .4s ease;
}

.scroll-top:hover {
  color: var(--ghost-accent-color);
}

.scroll-top:hover .progress-circle path, .scroll-top:hover .icon-tabler-arrow-up {
  stroke: var(--ghost-accent-color);
}

.content { max-width: 640px; margin: 0 auto; }

              
            
!

JS

              
                const scrollTopBtn = document.querySelector('.js-scroll-top');
if (scrollTopBtn) {
  scrollTopBtn.onclick = () => {
    window.scrollTo({top: 0, behavior: 'smooth'});
  }
  
  const progressPath = document.querySelector('.scroll-top path');
  const pathLength = progressPath.getTotalLength();
  progressPath.style.transition = progressPath.style.WebkitTransition = 'none';
  progressPath.style.strokeDasharray = `${pathLength} ${pathLength}`;
  progressPath.style.strokeDashoffset = pathLength;
  progressPath.getBoundingClientRect();
  progressPath.style.transition = progressPath.style.WebkitTransition = 'stroke-dashoffset 10ms linear';		
  const updateProgress = function() {
    const scroll = window.scrollY || window.scrollTopBtn || document.documentElement.scrollTopBtn;

    const docHeight = Math.max(
      document.body.scrollHeight, document.documentElement.scrollHeight,
      document.body.offsetHeight, document.documentElement.offsetHeight,
      document.body.clientHeight, document.documentElement.clientHeight
    );

    const windowHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);

    const height = docHeight - windowHeight;
    var progress = pathLength - (scroll * pathLength / height);
    progressPath.style.strokeDashoffset = progress;
  }

  updateProgress();
  const offset = 100;

  window.addEventListener('scroll', function(event) {
    updateProgress();

    //Scroll back to top
    const scrollPos = window.scrollY || window.scrollTopBtn || document.getElementsByTagName('html')[0].scrollTopBtn;
    scrollPos > offset ? scrollTopBtn.classList.add('is-active') : scrollTopBtn.classList.remove('is-active');

  }, false);
}


              
            
!
999px

Console