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

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

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.

            
              <div class="wrapper">
  <h2>Image, no options</h2>
  <!-- default -->
  <div class="default">
    <div class="svg basic"></div>
    <p class="caption">default</p>
  </div>
  <!-- IE -->
  <div class="ie8">
    <div class="svg basic"></div>
    <p class="caption">IE 8</p>
  </div>
  <!-- No SVG -->
  <div class="no-svg">
    <div class="svg basic"></div>
    <p class="caption">No SVG</p>
  </div>
</div>
<div class="wrapper">
  <h2>Set background size</h2>
  <!-- default -->
  <div class="default">
    <div class="svg awesome"></div>
    <p class="caption">default</p>
  </div>
  <!-- IE -->
  <div class="ie8">
    <div class="svg awesome"></div>
    <p class="caption">IE 8</p>
  </div>
  <!-- No SVG -->
  <div class="no-svg">
    <div class="svg awesome"></div>
    <p class="caption">No SVG</p>
  </div>
</div>
<div class="wrapper">
  <h2>Background cover</h2>
  <!-- default -->
  <div class="default">
    <div class="svg moreawesome"></div>
    <p class="caption">default</p>
  </div>
  <!-- IE -->
  <div class="ie8">
    <div class="svg moreawesome"></div>
    <p class="caption">IE 8</p>
  </div>
  <!-- No SVG -->
  <div class="no-svg">
    <div class="svg moreawesome"></div>
    <p class="caption">No SVG</p>
  </div>
</div>
            
          
!
            
              
//
// SVG Background
// -------
//
// FOR: Setting PNG fallbacks for SVG background images
//
// 1. Need to set a default image path (ex: ../img/)
// 2. This uses multiple background images as a proxy for SVG support
// 3. Necessary override for some versions of
//    Android, which choke on the double bg image
// 4. Background images need to be pre-sized for IE 8
//
// NOTE: You still need to set the display (inline-block or block)
//       and a height/width for the container
//
// REF: https://css-tricks.com/svg-fallbacks/
// USE: @include svg(envelope, 50% 50%);

@mixin svg(
    $bg-name: false,
    $bg-position: 50% 50%,
    $bg-color: transparent,
    $bg-size: 100%
  ) {

  // Variables
  //$svg-path [1]
  $svg: $svg-path + $bg-name + ".svg";
  $png: $svg-path + $bg-name + ".png";
  $png-ie: $svg-path + $bg-name + "-ie.png";

  background-image: url("#{$png}");
  background-image: url("#{$svg}"), none; // [2]

  // Other background properties
  background-color: $bg-color;
  background-repeat: no-repeat;
  background-position: $bg-position;
  background-size: $bg-size;

  .no-svg & {
    background-image: url("#{$png}"); // [3]
  }

  .ie8 & {
    background-image: url("#{$png-ie}"); // [4]
  }

} // svg

// -------

// Define a global variable for image directory
$svg-path: "http://www.thetrace.org/wp-content/themes/thetrace/static/img/icons/";

// Base Styles
// -------

* {
  box-sizing: border-box;
}
body {
  font-family: sans-serif;
}
.wrapper {
  width: 240px;
  margin: 0 auto 20px;
}
.wrapper > div {
  float: left;
  margin-right: 15px;
}
h2 {
  font-size: 18px;
}
.caption {
  text-align: center;
  color: #999;
  font-size: 12px;
}
.svg {
  display: block;
  width: 60px;
  height: 60px;
}

// Add your SVGs
// -------

.basic {
  @include svg(envelope);
}

.awesome {
  @include svg(envelope, 50% 50%, #bada55, 30px auto);
}

.moreawesome {
  @include svg(envelope, 50% 50%, #bada55, cover);
}

            
          
!
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