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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

              div, div::before, div::after {
  position: relative;
  box-sizing: border-box;

div {
  --color1: hsl(196, 50%, 50%);
  --color1alt: hsl(196, 50%, 30%);
  --color2: hsl(356, 70%, 50%);
  --color3alt: hsl(43, 80%, 50%);
  --height: 40vmin;
  --bellow-width: 50vmin;
  /* Default Button Radius */
  --button-dim: 1.4vmin;
  /*Default Button Radial Gradient/Shape */
  --button: radial-gradient(circle, var(--color1) var(--button-dim), transparent var(--button-dim));
  /* Since I want to animate a few buttons, set up specific button definitions: for 1, 4, 7, and 8. This will allow us to animate them individually later */
  --button1: radial-gradient(circle, var(--button1-color, var(--color1)) var(--button1-dim, var(--button-dim)), transparent var(--button1-dim, var(--button-dim)));
  --button4: radial-gradient(circle, var(--button4-color, var(--color1)) var(--button4-dim, var(--button-dim)), transparent var(--button4-dim, var(--button-dim)));
  --button7: radial-gradient(circle, var(--button7-color, var(--color1)) var(--button7-dim, var(--button-dim)), transparent var(--button7-dim, var(--button-dim)));
  --button8: radial-gradient(circle, var(--button8-color, var(--color1)) var(--button8-dim, var(--button-dim)), transparent var(--button8-dim, var(--button-dim)));
  /* Default Background Position */
  --button-x: -3vmin;
  --button-y: -16vmin;
  /* Override Default positions to give each button a unique position that is staggered */
  --button2-x: 2vmin; --button2-y: -12vmin;
  --button3-y: -8vmin;
  --button4-x: 2vmin; --button4-y: -4vmin;
  --button5-y: 0vmin;
  --button6-x: 2vmin; --button6-y: 4vmin;
  --button7-y: 8vmin;
  --button8-x: 2vmin; --button8-y: 12vmin;
  --button9-y: 16vmin;
  /* Red lines at top and bottom */
  --shine-horizontal: linear-gradient(to right, transparent 9.5%, var(--color2) 41.5%, var(--color2) 58.5%, transparent 86.5%);

/* button side of accordion */
div::after {
  height: calc(var(--height) + 7.5vmin);
  width: calc(var(--bellow-width) * .30);
  top: 0;
  bototm: 0;
  border-radius: 1vmin 4vmin 4vmin 1vmin; 
  /* Layered backgrounds, first is topmost background.
  For the buttons, use the specific ones if defined (1,4,7,8) otherwise use default definition. Only reason we give a specific one is to modify values later (in JS). */
    var(--button1, var(--button)), 
    var(--button2, var(--button)),
    var(--button3, var(--button)),
    var(--button4, var(--button)),
    var(--button5, var(--button)),
    var(--button6, var(--button)),
    var(--button7, var(--button)),
    var(--button8, var(--button)),
    var(--button9, var(--button)),
    /* The base of the right accordion side */
    linear-gradient(var(--color3alt), var(--color3alt));
  background-repeat: no-repeat;
  /* Structured to use button*-x if defined, otherwise use the default assigned to button-x. Same for y */
    1.5vmin 8%,
    1.5vmin 92%,
    var(--button1-x, var(--button-x)) var(--button1-y, var(--button-y)),
    var(--button2-x, var(--button-x)) var(--button2-y, var(--button-y)),
    var(--button3-x, var(--button-x)) var(--button3-y, var(--button-y)),
    var(--button4-x, var(--button-x)) var(--button4-y, var(--button-y)),
    var(--button5-x, var(--button-x)) var(--button5-y, var(--button-y)),
    var(--button6-x, var(--button-x)) var(--button6-y, var(--button-y)),
    var(--button7-x, var(--button-x)) var(--button7-y, var(--button-y)),
    var(--button8-x, var(--button-x)) var(--button8-y, var(--button-y)),
    var(--button9-x, var(--button-x)) var(--button9-y, var(--button-y)),
    center center;
  --default-size: 100%;
    80% 2px,
    80% 2px,
  box-shadow: inset -1vmin 0px 0px 1vmin rgba(235,235,239,.2);

div::before, div::after {
  content: '';
  position: absolute;
div {
  height: var(--height);
body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
  background: hsl(33, 80%, 9%);

              var div = document.querySelector('div');
var buttons = {};
const newDim = '1.2vmin';

function startIntervals() {
  setInterval(() => { pressButton(1) }, 900);
  setInterval(() => { pressButton(4) }, 1200);
  setInterval(() => { pressButton(7) }, 1600);
  setInterval(() => { pressButton(8) }, 1700);

function pressButton(index) {
  requestAnimationFrame(function() {
    var enabled = !!buttons[index]; 
    div.style.setProperty('--button'+index+'-dim', enabled ? newDim : 'var(--button-dim)');
    div.style.setProperty('--button'+index+'-color', enabled ? 'var(--color1alt)' : 'var(--color1)');
    buttons[index] = !enabled;

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