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.

+ add another resource

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

            
              
<header class="container">
<h1><a href="https://codepen.io/atelierbram/pen/cpmnD">Animated box frame with embedded SVG-files</a></h1>
</header>

<div class="container container--animation">

  <div class="top-gradient ab"> 
    <svg version="1.1" id="top-gradient" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
    width="1152px" height="8px" viewBox="0 0 1152 8" xml:space="preserve">
    <linearGradient id="topGradient" gradientUnits="userSpaceOnUse" x1="-1595" y1="-1833" x2="-443" y2="-1833" gradientTransform="matrix(1 0 0 1 1595 1837)">
    <stop  offset="0" style="stop-color:#00FFFF"/>
    <stop  offset="0.25" style="stop-color:#0040FF"/>
    <stop  offset="0.5" style="stop-color:#8206FF"/>
    <stop  offset="0.75" style="stop-color:#FF00BF"/>
    <stop  offset="1" style="stop-color:#FF0000"/>
    </linearGradient>
    <rect fill="url(#topGradient)" width="1152" height="8"/>
    </svg>
  </div>


  <div class="mat-horizontal-rtl ab"> 
    <svg version="1.1" id="matHorizontalRtl" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
    width="2304px" height="10px" viewBox="0 0 2304 10" xml:space="preserve">
    <g>
    <rect x="112" width="64" height="10"/>
    <rect x="256" width="64" height="10"/>
    <rect x="400" width="64" height="10"/>
    <rect x="544" width="64" height="10"/>
    <rect x="688" width="64" height="10"/>
    <rect x="832" width="64" height="10"/>
    <rect x="976" width="64" height="10"/>
    <rect x="1120" width="64" height="10"/>
    <rect x="1264" width="64" height="10"/>
    <rect x="1408" width="64" height="10"/>
    <rect x="1552" width="64" height="10"/>
    <rect x="1696" width="64" height="10"/>
    <rect x="1840" width="64" height="10"/>
    <rect x="1984" width="64" height="10"/>
    <rect x="2128" width="64" height="10"/>
    <rect x="2272" width="32" height="10"/>
    <rect width="32" height="10"/>
    </g>
    </svg> 
  </div>

  <div class="left-gradient ab"> 
    <svg version="1.1" id="left-gradient" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
    width="8px" height="1152px" viewBox="0 0 8 1152" xml:space="preserve">
    <linearGradient id="leftGradient" gradientUnits="userSpaceOnUse" x1="-748" y1="1450" x2="404" y2="1450" gradientTransform="matrix(0 1 1 0 -1446 748)">
    <stop  offset="0" style="stop-color:#00FFFF"/>
    <stop  offset="0.25" style="stop-color:#0040FF"/>
    <stop  offset="0.5" style="stop-color:#8206FF"/>
    <stop  offset="0.75" style="stop-color:#FF00BF"/>
    <stop  offset="1" style="stop-color:#FF0000"/>
    </linearGradient>
    <rect fill="url(#leftGradient)" width="8" height="1152"/>
    </svg>
  </div>

  <div class="mat-vertical-left ab"> <svg version="1.1" id="mat-verticalLeft" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
    width="10px" height="2304px" viewBox="0 0 10 2304" xml:space="preserve">
    <g>
    <rect y="112" width="10" height="64"/>
    <rect y="256" width="10" height="64"/>
    <rect y="400" width="10" height="64"/>
    <rect y="544" width="10" height="64"/>
    <rect y="688" width="10" height="64"/>
    <rect y="832" width="10" height="64"/>
    <rect y="976" width="10" height="64"/>
    <rect y="1120" width="10" height="64"/>
    <rect y="1264" width="10" height="64"/>
    <rect y="1408" width="10" height="64"/>
    <rect y="1552" width="10" height="64"/>
    <rect y="1696" width="10" height="64"/>
    <rect y="1840" width="10" height="64"/>
    <rect y="1984" width="10" height="64"/>
    <rect y="2128" width="10" height="64"/>
    <rect y="2272" width="10" height="32"/>
    <rect width="10" height="32"/>
    </g>
    </svg> 
  </div> 

  <div class="bottom-gradient ab"> 
    <svg version="1.1" id="bottom-gradient" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
    width="1152px" height="8px" viewBox="0 0 1152 8" xml:space="preserve">
    <linearGradient id="bottomGradient" gradientUnits="userSpaceOnUse" x1="-1775" y1="1540" x2="-623" y2="1540" gradientTransform="matrix(-1 0 0 1 -623 -1536)">
    <stop  offset="0" style="stop-color:#00FFFF"/>
    <stop  offset="0.25" style="stop-color:#0040FF"/>
    <stop  offset="0.5" style="stop-color:#8206FF"/>
    <stop  offset="0.75" style="stop-color:#FF00BF"/>
    <stop  offset="1" style="stop-color:#FF0000"/>
    </linearGradient>
    <rect fill="url(#bottomGradient)" width="1152" height="8"/>
    </svg> 
  </div> 

  <div class="mat-horizontal-ltr ab"> 
    <svg version="1.1" id="Laag_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
    width="2304px" height="10px" viewBox="0 0 2304 10" xml:space="preserve">
    <g>
    <rect x="112" width="64" height="10"/>
    <rect x="256" width="64" height="10"/>
    <rect x="400" width="64" height="10"/>
    <rect x="544" width="64" height="10"/>
    <rect x="688" width="64" height="10"/>
    <rect x="832" width="64" height="10"/>
    <rect x="976" width="64" height="10"/>
    <rect x="1120" width="64" height="10"/>
    <rect x="1264" width="64" height="10"/>
    <rect x="1408" width="64" height="10"/>
    <rect x="1552" width="64" height="10"/>
    <rect x="1696" width="64" height="10"/>
    <rect x="1840" width="64" height="10"/>
    <rect x="1984" width="64" height="10"/>
    <rect x="2128" width="64" height="10"/>
    <rect x="2272" width="32" height="10"/>
    <rect width="32" height="10"/>
    </g>
    </svg> 
  </div>

  <div class="right-gradient ab"> 
    <svg version="1.1" id="right-gradient" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
    width="8px" height="1152px" viewBox="0 0 8 1152" xml:space="preserve">
    <linearGradient id="rightGradient" gradientUnits="userSpaceOnUse" x1="-748" y1="1450" x2="404" y2="1450" gradientTransform="matrix(8.979319e-11 -1 -1 -8.979319e-11 1454 404)">
    <stop  offset="0" style="stop-color:#00FFFF"/>
    <stop  offset="0.25" style="stop-color:#0040FF"/>
    <stop  offset="0.5" style="stop-color:#8206FF"/>
    <stop  offset="0.75" style="stop-color:#FF00BF"/>
    <stop  offset="1" style="stop-color:#FF0000"/>
    </linearGradient>
    <rect fill="url(#rightGradient)" width="8" height="1152"/>
    </svg>
  </div>

  <div class="mat-vertical-right ab"> 
    <svg version="1.1" id="mat-verticalRight" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
    width="10px" height="2304px" viewBox="0 0 10 2304" xml:space="preserve">
    <g>
    <rect y="112" width="10" height="64"/>
    <rect y="256" width="10" height="64"/>
    <rect y="400" width="10" height="64"/>
    <rect y="544" width="10" height="64"/>
    <rect y="688" width="10" height="64"/>
    <rect y="832" width="10" height="64"/>
    <rect y="976" width="10" height="64"/>
    <rect y="1120" width="10" height="64"/>
    <rect y="1264" width="10" height="64"/>
    <rect y="1408" width="10" height="64"/>
    <rect y="1552" width="10" height="64"/>
    <rect y="1696" width="10" height="64"/>
    <rect y="1840" width="10" height="64"/>
    <rect y="1984" width="10" height="64"/>
    <rect y="2128" width="10" height="64"/>
    <rect y="2272" width="10" height="32"/>
    <rect width="10" height="32"/>
    </g>
    </svg>

  </div>


  <article class="article"> 

  <p>( Containing div &#8217;s of ) Embedded SVG-files are absolute positioned, ( black rectangles on top of linear-gradients: ) top div with black rectangles is animated using css-animations.</p>
  <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
  <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p> 
  </article>
            
          
!
            
              * {
  margin: 0;
  padding: 0;
  border: 0;
  vertical-align: baseline;
}

html {
  min-height: 100%;
  background-color: black;
  color: silver;
}

body {
  font: 100%/1.375 AvenirNext-Regular, Corbel, "Lucida Grande", "Lucida Unicode", "Lucida Sans", "Trebuchet Ms", sans-serif;
}

h1 {
  margin: 0 0 .5em;
  text-align: center;
  font-family: AvenirNextCondensed-DemiBold, Corbel, "Lucida Grande", "Lucida Sans", "Trebuchet Ms", Futura, sans-serif;
}

.container {
  margin: 0 5%;
  position: relative;
  overflow: hidden;
}

.container--animation {
  height: 1152px;
  margin-bottom: 2em;
}

.article {
  margin: 3em 0;
}

p {
  margin: 0 10%;
  padding: .5em 0;
}

p:first-child {
  font-size: 1.25em;
  color: white;
}

a {
  color: #f07;
  text-decoration: none;
}

.ab {
  position: absolute;
}

.top-gradient,
.bottom-gradient {
  z-index: -1;
  left: 0;
  height: 8px;
}

.top-gradient {
  top: 0;
}

.bottom-gradient {
  bottom: 8px;
}

.left-gradient,
.right-gradient {
  z-index: -1;
  top: 16px;
  height: 1152px;
  width: 8px;
}

.left-gradient {
  left: 0;
}

.right-gradient {
  right: 0;
}

.mat-horizontal-rtl,
.mat-horizontal-ltr {
  left: 0;
  height: 10px;
  transition-property: margin-left;
  animation-duration: 5s;
  animation-iteration-count: infinite;
  animation-timing-function: linear;
}

.mat-horizontal-rtl {
  top: 1px;
  z-index:1;
  animation-name: slidein;
}

.mat-horizontal-ltr {
  bottom: 6px;
  height: 9px;
  z-index:2;
  animation-name: slideout;
}

.mat-vertical-left,
.mat-vertical-right {
  top: 16px;
  z-index: 3;
  height: 1152px;
  width: 10px;
  transition-property: margin-top;
  animation-duration: 5s;
  animation-iteration-count: infinite;
  animation-timing-function: linear;
}

.mat-vertical-left {
  left: -1px;
  animation-name: slideinvertical;
}

.mat-vertical-right {
  right: 1px;
  animation-name: slideoutvertical;
}

@keyframes slidein {
  from {
    margin-left: 0;
    width: 200%
  }
  to {
    margin-left:-100%;
    width: 200%;
  }
}

@keyframes slideout {
  from {
    margin-left: -100%;
    width: 200%
  }
  to {
    margin-left: 0;
    width: 200%;
  }
}

@keyframes slideinvertical  {
  from {
    margin-top: -100%;
    width: 8px;
  }
  to {
    margin-top: 0;
    width: 8px;
  }
}

@keyframes slideoutvertical {
  from {
    margin-top: 0;
    width: 8px;
  }
  to {
    margin-top: -100%;
    width: 8px;
  }
}

@media only screen and (max-width: 25em) {

  p {
    font-size: .875em;
  }

}

@media only screen and (min-width: 25em) {

  .container,
  .top-gradient,
  .bottom-gradient {
    width: 27em;
    margin: 0 auto;
  }

  .container--animation {
    margin-bottom: 2em;
  }

  p {
    margin: 0 12.5%;
  }

}

@media only screen and (min-width: 52em) {

  .container, .top-gradient, .bottom-gradient {
    width: 54em;
    margin: 0 auto;
  }

  .container--animation {
    margin-bottom: 2em;
  }

  p {
    margin: 0 18%;
  }

}

@media only screen and (min-width: 74em) {

  .container, .top-gradient, .bottom-gradient {
    width: 72em;
    margin: 0 auto;
  }

  .container--animation {
    margin-bottom: 2em;
  }

  p {
    margin: 0 25%;
  }

} 
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console