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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

              
                <article id="content">
  <p id="fakescroll"><i></i></p>
  <h1>HTML Ipsum Presents</h1>

  <section>
    <aside id="note1"><b>senectus</b> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue.</aside>

    <p><strong>Pellentesque habitant morbi tristique</strong> senectus<a href="#note1">(*)</a> et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href="#">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p>
  </section>

  <h2>Header Level 2</h2>

  <ol>
    <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
    <li>Aliquam tincidunt mauris eu risus.</li>
  </ol>
  <section>
    <blockquote>
      <p>Lorem ipsum dolor sit amet<a href="#note2">(*)</a>, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.</p>
    </blockquote>
    <aside id="#note2" class="right">
      Hello , another note.<br>too long ?<br>too long ?<br>too long ?<br>too long ?<br>too long ?<br>too long ?<br>too long ?
    </aside>
  </section>

  <h3>Header Level 3</h3>

  <ul>
    <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
    <li>Aliquam tincidunt mauris eu risus.</li>
  </ul>

  <pre><code>
#header h1 a {
  display: block;
  width: 300px;
  height: 80px;
}
</code></pre>
  </code>
              
            
!

CSS

              
                * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-width: 1200px;
  position: relative;
}
#content {
  height: 100vh;
  overflow: auto;
}
article {
  background: linear-gradient(
      to right,
      blue 2px,
      lightgray 2px,
      lightgray calc(100% - 2px),
      blue calc(100% - 2px)
    )
    no-repeat center / 820px 100%;
}

article,
section {
  display: grid;
  grid-template-columns: 1fr 800px 1fr;
  gap: 0px;
}
section {
  grid-column: 1 / span 3;
}
article > :not(aside):not(section),
section > :not(aside) {
  grid-column: 2;
  padding:0.15em 1em;
}
aside {
  grid-column: 1;
  height: 0;
  min-height: 100%;
  overflow: auto;
  border: solid;
  margin: 0 1em 0 auto;
}
aside.right {
  grid-column: 3;
  margin: 0 auto 0 2.4em;
}
#fakescroll {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  margin: 0;
  transform: translate(375px, 0);
  overflow-y: auto;
  width: 1em;
  height: 100vh;
  box-sizing: border-box; 
}
#fakescroll i {
  display: block;
  height: 100%;
}

              
            
!

JS

              
                window.onload = resetH;
window.onresize = resetH;

function resetH() {
  let scrollH = document.querySelector("#content").scrollHeight;// on recupere la hauteur de #content
  let myScroll = document.querySelector("#fakescroll i");//on recupere l'element qui va etre redimensionné pour déclanché l'apparition de la barre de scroll
  myScroll.style.paddingTop = scrollH + "px";// on ajoute un padding a sa hauteur initiale pour l'étiré
}

// synchro des scrolls
let s1 = document.querySelector("#content");
let s2 = document.querySelector("#fakescroll");
function select_scroll_1(e) {
  s2.scrollTop = s1.scrollTop;
}
function select_scroll_2(e) {
  s1.scrollTop = s2.scrollTop;
}
s1.addEventListener("scroll", select_scroll_1, false);
s2.addEventListener("scroll", select_scroll_2, false);

              
            
!
999px

Console