Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ add another resource


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


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.


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.


      <a class="sktech-back-to-top" href="#top"><span class="sktech-back-to-top">Back to top</span></a>
<div id="smooth-wrapper">
  <div id="smooth-content">
    <section id="top"><div class="top-marker">Top of the page</div></section>


                body {
  margin: 0;
  padding: 0;

section {
  width: 100%;
  min-height: 55vh;
  background: darkred;
  text-align: center;
  padding: 120px 0;

section:nth-child(2n) {
  background: black;

.top-marker {
  position: absolute;
  top: 0;
  width: 200px;
  height: 50px;
  background: orange;
  left: calc(50% - 100px);
  line-height: 50px;
  font-family: arial;
  font-weight: 700;

a.sktech-back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: inline-block;
  text-decoration: none;
  background: orange;
  color: white;
  padding: 8px 18px;
  transition: all 0.3s ease 0s;
  z-index: 1;

a:hover {
  background: red;


                gsap.registerPlugin(ScrollTrigger, ScrollSmoother);

// create the smooth scroller FIRST!
let smoother = ScrollSmoother.create({
  smooth: 2,   // seconds it takes to "catch up" to native scroll position
  effects: true // look for data-speed and data-lag attributes on elements and animate accordingly

// Detect if a link's href goes to the current page
	function getSamePageAnchor (link) {
		if (
			link.protocol !== window.location.protocol || !== ||
			link.pathname !== window.location.pathname || !==
		) {
			return false;

		return link.hash;

	// Scroll to a given hash, preventing the event given if there is one
	function scrollToHash(hash, e) {
		const elem = hash ? document.querySelector(hash) : false;
		if ( elem ) {
			if ( e ) e.preventDefault();
			// window, { scrollTo: elem } );
      smoother.scrollTo(elem, true)

	// If a link's href is within the current page, scroll to it instead
	document.querySelectorAll( 'a[href]' ).forEach( a => {
		a.addEventListener( 'click', e => {
			scrollToHash( getSamePageAnchor( a ), e );

	// Scroll to the element in the URL's hash on load