Pen Settings

HTML

CSS

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

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

Auto Save

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

              
                <figure>

  <div class="granular" role="group" aria-roledescription="explorable image" tabindex="0" aria-label="Diagrammatic explanation of the Lever Principle" data-level="1">
    <div style="grid-column: 1/4; grid-row: 1/1;height: 40px;z-index: 2;" role="img" data-level="2" aria-hidden="true" aria-label="Mass 1 times distance lower A equals Mass 2 times distance lower B. "></div>
    <div style="grid-column: 1/4; grid-row: 2/2; height: 70px;z-index: 2;   display: grid; grid-template-columns: 1fr 1fr 1fr" role="img" data-level="2" aria-hidden="true" aria-label="A lever diagram with Mass 1 on the left, a pivot, and Mass 2 on the right">
      <div style="grid-column: 1/1; grid-row: 2/2;height: 40px;width: 70%;z-index: 3;" role="img" data-level="3" aria-hidden="true" aria-label="A lever diagram with Mass 1 on the left,">
      </div>
      <div style="grid-column: 2/2;grid-row: 2/2;height: 60px;width: 50%;z-index: 3;" role="img" data-level="3" aria-hidden="true" aria-label="The pivot,">
      </div>
      <div style="grid-column: 3/3;grid-row: 2/2;height: 40px;z-index: 3;" role="img" data-level="3" aria-hidden="true" aria-label="and Mass 2 on the right">
      </div>
    </div>
    <div style="grid-column: 1/4; grid-row: 3/3; height: 70px;z-index: 2;   display: grid; grid-template-columns: 1fr 1fr 1fr" role="img" data-level="2" aria-hidden="true" aria-label="The distances to the pivot point">
      <div style="grid-column: 1/1; grid-row: 2/2;height: 40px;width: 70%;z-index: 3;" role="img" data-level="3" aria-hidden="true" aria-label="The distance lower case A, from Mass 1 to the pivot point.">
      </div>
      <div style="grid-column: 2/2;grid-row: 2/2;height: 60px;width: 50%;z-index: 3;" role="img" data-level="3" aria-hidden="true" aria-label="and">
      </div>
      <div style="grid-column: 3/3;grid-row: 2/2;height: 40px;z-index: 3;" role="img" data-level="3" aria-hidden="true" aria-label="The distance lower case b, from the pivot point to  Mass 2.">
      </div>
    </div>
    <img width="512" alt="" src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/c3/Lever_Principle_3D.png/512px-Lever_Principle_3D.png">
  </div>

  <figcaption>Attribution: Jjw, <a href="https://creativecommons.org/licenses/by-sa/3.0">CC BY-SA 3.0</a> <a href="https://commons.wikimedia.org/wiki/File:Lever_Principle_3D.png">
      via Wikimedia Commons</a>
  </figcaption>
</figure>
              
            
!

CSS

              
                .granular {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 2fr 1fr 1fr;
  width: max-content;
}

.granular img {
  grid-column: 1/4;
  grid-row: 1/5;
}

div > div {
  border: 1px dashed black;
}

              
            
!

JS

              
                
              
            
!
999px

Console