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

              
                // Inspired by and forked from https://codepen.io/argyleink/pen/NPWMNyX

- const duration = 15 // seconds
- const columns = 32
- let dots = columns * (columns / 4 * 3)

img(src="https://cssence.github.io/assets/placeholder.jpg", alt="The offical @CSSence placeholder image happens to be a picture of a sleeping cat.")
.reveal
  while dots--
    b(style=`--delay:${Math.random()*duration}s;`)

              
            
!

CSS

              
                * {
  box-sizing: border-box;
}
body {
  --columns: 32;
  --rows: calc(var(--columns) / 4 * 3);
  --dot-size: calc((100vmin - 2rem) / var(--columns));
  block-size: calc(var(--dot-size) * var(--rows));
  inline-size: calc(var(--dot-size) * var(--columns));
  margin-block: 1rem 5rem;
  margin-inline: auto;
}
body, .reveal {
  display: grid;
}
img,
.reveal {
  grid-area: 1 / -1 / 1 / -1;
  block-size: 100%;
  inline-size: 100%;
}
.reveal {
  grid-template-columns: repeat(var(--columns), var(--dot-size));
  grid-auto-rows: var(--dot-size);
}
img {
  border: 1px solid transparent;
}
/* Using 32 columns, there'll be (32×24=)
   768 <b> elements. I'm sorry.
*/
b {
  background-color: Canvas;
  forced-colors-adjust: none;

  transition: opacity .5s ease var(--delay), visibility .5s ease var(--delay);
  transition-behavior: allow-discrete;

  visibility: hidden;
  opacity: 0;
  
  @starting-style {
    visibility: visible;
    opacity: 1;
  }
  /* Toggling visibility with allow-discrete allows us
     to right-click the image when the squares are gone.
     As of 2025-04-07, this does not work in Firefox,
     but that's kinda fine, as the reveal does work.
  */
}

              
            
!

JS

              
                
              
            
!
999px

Console