Pen Settings



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


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.


    <nav id="outside-router">
      <button data-link="route-1">Route-1</button>
      <button data-link="route-2">Route-2</button>
    <div id="router-wrapper" role="group" tabindex="-1">
    <div id="route-1">
        <p>Doggo ipsum i am bekom fat boofers big ol pupper pupperino long bois wow such tempt, dat tungg tho you are doing me the shock dat tungg tho you are doin me a concern. Sub woofer borkf long bois boofers h*ck aqua doggo, fat boi wow very biscit pupper. Smol maximum borkdrive big ol pupper waggy wags, length boy wow such tempt. Porgo you are doing me the shock long water shoob blep shibe, yapper heckin good boys doggo, boofers noodle horse shooberino. Dat tungg tho ur givin me a spook wow such tempt doggo, borking doggo ruff much ruin diet h*ck, corgo big ol pupper. You are doing me a frighten doge long bois big ol puggo dat tungg tho, much ruin diet shooberino bork heckin angery woofer. I am bekom fat long bois very taste wow woofer shooberino, woofer thicc. Borking doggo big ol the neighborhood pupper super chub smol borking doggo with a long snoot for pats long water shoob, stop it fren I am bekom fat h*ck. Very hand that feed shibe super chub blep, you are doing me a frighten.</p>
    <div id="route-2">
        Route-2 (not in main landmark)         </h1>
      Before landmark
      <main>In landmark</main>
      After landmark


                #router-wrapper {
  background: beige;
  padding: 1em 1.5em;

#outside-router {
  background: cadetblue;
  padding: 1em;

.routeSkipHeading {
    position: relative;
.routeSkipLink {
    display: inline-block;
    margin-left: -0.75em;
    opacity: 0;
    position: absolute;
    text-decoration: none;
.routeSkipLink:before {
    content: '⇽';
    display: block;
.routeSkipLink:hover {
    opacity: 1;


                const routerWrapper = document.querySelector(`#router-wrapper`)

const routeSkipLink = () => {
  const targetID = 'outside-router'
  let a = document.createElement('a')
  a.setAttribute('id', 'skip-main')
  a.setAttribute('href', `#${targetID}`)
  a.setAttribute('aria-label', `back to ${targetID}`)
  return a
const routes = {}

let cleanupFns = []

const initRoute = id => {
  const routeElement = document.querySelector(`#${id}`)
  const routeHeading = routeElement.querySelector('h1')
  routes[id] = routeElement

const setRoute = (id, clicked = false) => {
  cleanupFns.forEach(fn => fn())
  cleanupFns = []
  while (routerWrapper.firstChild) {
  /* Here's part we can experiment with */
  requestAnimationFrame(() => {
    // routerWrapper.focus()
    if (clicked && routes[id].querySelector('.routeSkipLink')) {
  /* End of part to experiment with */



document.querySelectorAll(`#outside-router [data-link]`).forEach(link => {
    const clickHandler = () => {
      setRoute(link.getAttribute('data-link'), true)
    link.addEventListener('click', clickHandler)