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.

            
              

div {
  --zipper-x: 13;
}

div:before {
  background-image: 
    /* inside zipper loop */
    radial-gradient(circle closest-corner at calc(var(--zipper-x) * 1px) 29px , #af342c, #af342c 2px, transparent 2px, transparent),
    /* outside zipper loop */
    radial-gradient(circle closest-corner at calc(var(--zipper-x) * 1px) 29px , #491033, #491033 4px, transparent 4px, transparent), 
    /* pocket flap above zipper */
    linear-gradient(to bottom, transparent 10px, transparent 15px, #491033 5px, #491033 18px, transparent 18px, transparent 100px), 
    /* main zipper rectangle */
    linear-gradient(to right, #af342c calc(calc(var(--zipper-x) * 1px) - 3px), transparent calc(calc(var(--zipper-x) * 1px) - 3px), calc(calc(var(--zipper-x) * 1px) + 3px), #af342c calc(calc(var(--zipper-x) * 1px) + 3px)), 
    linear-gradient(to bottom, #af342c 8px, #af342c 16px, #491033 8px, #491033 30px, #af342c 20px, #af342c 72px, #af342c 10px, #af342c 57px, #af342c 5%);
  
  
  height: 75px;
  width: 118px;
  margin-left: 22px;
  margin-top: 58px;
  border: 4px solid #491033;
  border-radius: 11px;
  box-shadow: 0 4px 0 0 #c1382e, inset 0px 4px 1px 0 #c03527;
  content: '||';
  color: transparent;
  font-family: Comic Sans MS;
  font-weight: bold;
  z-index: 1;
  text-shadow: rgb(0, 0, 0) -2px -86px 0px;
  font-size: 14px;
}

div:after {
  margin-left: 67px;
  margin-top: -30px;
  background: #cca16a;
  width:26px;
  height:26px;
  border: 3px solid #491033;
  border-radius: 3px;
  transform: rotate(45deg);
  content: '';
}

div:before, 
div:after {
  display: block;
  position: absolute;
}

div {
  width: 170px;
  height: 180px;
  padding-top: 80px;
  background-color: #d84736;
  box-shadow: 
    inset 0 6px 0 2px #e64a3e, 
    0 6px 2px -2px #1a858b, 
    0 -93px 0 -81px #25aaa7, 
    0 -93px 0 -77px #3b1045, 
    0 -93px 0 -72px #d84736, 
    0 -93px 0 -68px #3b1045;
  background-image: linear-gradient(to right, #c1382e 230px, transparent 231px);
  background-position: center 254px;
  background-size: 305px 6px;
  background-repeat: repeat-x; 
  border: 5px solid #410c38;
  border-radius: 85px 85px 44px 44px;
}



body {
  text-align: center;
  background: #25aaa7;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}
            
          
!
            
              var div = document.querySelector('div');
var x = parseFloat(getComputedStyle(div).getPropertyValue('--zipper-x'));
var toTheRight = true;

function moveZipper() {
  x = x + (toTheRight ? .5 : -.5);
  div.style.setProperty('--zipper-x', x);
  if (x >= 110 || x <= 10) {
    toTheRight = !toTheRight; //change direction
    setTimeout(function() {
      requestAnimationFrame(moveZipper);
    }, 3000);
  } else {
    requestAnimationFrame(moveZipper);
  }
}
moveZipper();


//Alternate Code would look like
/*

  'radial-gradient(circle closest-corner at ' + x + 'px 29px , #af342c, #af342c 2px, transparent 2px, transparent), 
    radial-gradient(circle closest-corner at ' + x + 'px 29px , #491033, #491033 4px, transparent 4px, transparent), 
    linear-gradient(to bottom, transparent 10px, transparent 15px, #491033 5px, #491033 18px, transparent 18px, transparent 100px), 
    linear-gradient(to right, #af342c ' + (x - 3) + 'px, transparent ' + (x - 3) + 'px, ' + (x + 3) + 'px, #af342c ' + (x + 3) + 'px, 
    linear-gradient(to bottom, #af342c 8px, #af342c 16px, #491033 8px, #491033 30px, #af342c 20px, #af342c 72px, #af342c 10px, #af342c 57px, #af342c 5%)';

*/
            
          
!
999px
Loading ..................

Console