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.


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.


  if ('paintWorklet' in CSS) {
    // load this CodePen's JS file as the paint worklet
  } else {

<header class="placeholder"></header>
<div class="content-wrapper">
    <h1>Awesome Mockup</h1>
    <p>This uses placeholder boxes created with the CSS Paint API. Neat! You can resize them by dragging their bottom right corners.</p>
    <div class="row">
      <div class="placeholder"></div>
      <div class="placeholder"></div>
      <div class="placeholder"></div>
    <p>That's all. Thanks!</p>
    <div class="placeholder"></div>

<div class="warning">
  <i class="fas fa-exclamation-triangle"></i><br>
  This Houdini demo requires the <strong>CSS Paint API</strong>.<br>
  Use <strong>Chrome</strong>.<br>
  Also make sure you're serving over <strong>https</strong> or <strong>localhost</strong>.



                *, *::before, *::after {
  box-sizing: border-box;

body {
  margin: 20px;
  color: #666;
  background-color: #eee;
  font: 1rem/1.25 'Mukta Mahee', sans-serif;

.placeholder {
  background-image: paint(placeholder-box);

  background-color: #fff;
  max-width: 100%;
  border: 2px solid #666;
  overflow: auto;
  resize: both;

header {
  width: 600px;
  height: 100px;
  margin: 0 auto;

.content-wrapper {
  display: flex;
  width: 600px;
  margin: 40px auto 0;
  font-size: 1.25rem;
  line-height: 1;

main {
  width: 440px;

h1 {
  margin: 0;
  font-weight: normal;

p {
  line-height: 1.25;

.row {
  margin: 0 10px 0 -10px;

.row::after {
  content: '';
  display: block;
  clear: both;

main .placeholder {
  float: left;
  width: 100px;
  height: 100px;
  margin: 10px;

aside {
  width: 140px;
  margin-left: 20px;

aside .placeholder {
  width: 140px;
  height: 320px;
  margin: 0 auto;

.warning {
  display: none;
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  padding: 20px;
  border-top: 4px dashed #e8590c;
  background-color: #ffe8cc;
  color: #e8590c;
  text-align: center;

.no-support .warning {
  display: block;

.warning .fas {
  margin-bottom: 1rem;
  font-size: 1.5rem;



This CodePen's JS file has been "hijacked" to serve as the paint worklet file. The if check below ensures the code only runs when referenced as such. JavaScript for the page is at the top of the HTML. I'm only doing this to squeeze everything into one CodePen.

IMPORTANT: If you fork, update the CodePen JS file path in the HTML.

ALSO IMPORTANT: If you edit code here, disable cache and reload. Live preview won't pick up changes in the paint worklet.

if (typeof registerPaint !== 'undefined') {
  class PlaceholderBoxPainter {
    paint(ctx, size) {
      ctx.lineWidth = 2;
      ctx.strokeStyle = '#666';

      // draw line from top left to bottom right
      ctx.moveTo(0, 0);
      ctx.lineTo(size.width, size.height);

      // draw line from top right to bottom left
      ctx.moveTo(size.width, 0);
      ctx.lineTo(0, size.height);

  registerPaint('placeholder-box', PlaceholderBoxPainter);