cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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. 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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation


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.

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

<div class="container">
  <div class="slot">
    <div class="placeholder"></div>
  <div class="slot">
    <div class="placeholder"></div>
  <div class="slot">
    <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> and <strong>Typed OM</strong>.<br>
  Use <strong>Chrome</strong> and go to <strong>chrome://flags</strong> and enable <strong>Experimental Web Platform features</strong>.<br>
  Also make sure you're serving over <strong>https</strong> or <strong>localhost</strong>.

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

html, body {
  height: 100%;

body {
  margin: 0 20px;
  background-image: linear-gradient(to bottom, #70e1f5, #ffd194);
  font: 1rem/1.25 'Mukta Mahee', sans-serif;

.container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-gap: 20px;
  align-items: center;
  height: 100%;

.slot {
  display: flex;
  justify-content: center;

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

  background-color: #fff;
  width: 120px;
  height: 120px;
  max-height: 100vh;
  overflow: auto;
  resize: both;

.slot:nth-child(1) .placeholder {
  border: 2px solid #fd7e14;

.slot:nth-child(2) .placeholder {
  border: 6px solid #228be6;

.slot:nth-child(3) .placeholder {
  border: 1rem solid #e64980;

.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 PlaceholderBoxPropsPainter {
    static get inputProperties() {
      return ['border-top-width', 'border-top-color'];

    paint(ctx, size, props) {
      // default values
      ctx.lineWidth = 2;
      ctx.strokeStyle = '#666';

      // set line width to top border width (if exists)
      let borderTopWidthProp = props.get('border-top-width');
      if (borderTopWidthProp) {
        ctx.lineWidth = borderTopWidthProp.value;

      // set stroke style to top border color (if exists)
      let borderTopColorProp = props.get('border-top-color');
      if (borderTopColorProp) {
        ctx.strokeStyle = borderTopColorProp.toString();

      // 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-props', PlaceholderBoxPropsPainter);

Loading ..................