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

Console