css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              .explanation

  .original
    
    %h3
      Original
  
    <?xml version="1.0" encoding="utf-8"?>
    <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
    width="48px" height="48px" viewBox="0 0 48 48" enable-background="new 0 0 48 48" xml:space="preserve">
    <g id="BG_-_circle_99_">
    <g>
    <circle fill="#A4BE60" cx="24" cy="24" r="24"/>
    </g>
    </g>
    <g id="Envelope_base">
    <g>
    <path fill="#FFFFFF" d="M37,14H11c-1.104,0-2,0.896-2,2v17c0,1.104,0.896,2,2,2h26c1.104,0,2-0.896,2-2V16
    C39,14.896,38.104,14,37,14z"/>
    </g>
    </g>
    <g id="Shade">
    <g>
    <path fill="#E8E8E8" d="M24,28L9,16v17c0,1.104,0.896,2,2,2h26c1.104,0,2-0.896,2-2V16L24,28z"/>
    </g>
    </g>
    <g id="Crease_1_">
    <g>
    <polygon fill="#C1C0C0" points="24,26 9.11,16 23.982,28.519 38.819,16     "/>
    </g>
    </g>
    </svg>
  
    <?xml version="1.0" encoding="utf-8"?>
    <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
    width="48px" height="48px" viewBox="0 0 48 48" enable-background="new 0 0 48 48" xml:space="preserve">
    <g id="BG_-_circle_79_">
    <g>
    <circle fill="#D3524D" cx="24" cy="24" r="24"/>
    </g>
    </g>
    <g id="Glass_3_" opacity="0.6392">
    <g>
    <path fill="#FFFFFF" d="M28.723,35.714L31,15H16l2.277,20.714c0,0-0.852,0.63-1.121,1.179c-0.29,0.593,0,1.107,0,1.107h12.723
    c0,0,0.287-0.54,0-1.107C29.588,36.316,28.723,35.714,28.723,35.714z"/>
    </g>
    </g>
    <g id="Peroni">
    <g>
    <polygon fill="#D68333" points="18,18 20,36 27,36 29,18     "/>
    </g>
    </g>
    <g id="Head">
    <g>
    <path fill="#FFFFFF" d="M23.663,15C20.859,15,18,15,18,15v3h11v-3C29,15,26.357,15,23.663,15z"/>
    </g>
    </g>
    <g id="Bubbles_1_" opacity="0.302">
    <g>
    <path fill="#FFFFFF" d="M23.5,32c-0.276,0-0.5,0.224-0.5,0.5s0.224,0.5,0.5,0.5s0.5-0.224,0.5-0.5S23.776,32,23.5,32z M22,28
    c-0.553,0-1,0.447-1,1s0.447,1,1,1s1-0.447,1-1S22.553,28,22,28z M24,24c-0.553,0-1,0.447-1,1s0.447,1,1,1s1-0.447,1-1
    S24.553,24,24,24z"/>
    </g>
    </g>
    </svg>
  
    <?xml version="1.0" encoding="utf-8"?>
    <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
    width="48px" height="48px" viewBox="0 0 48 48" enable-background="new 0 0 48 48" xml:space="preserve">
    <g id="BG_-_circle_52_">
    <g>
    <circle fill="#D3524C" cx="24" cy="24" r="24"/>
    </g>
    </g>
    <g id="Handle_9_">
    <g>
    <path fill="#C8C7C7" d="M30.82,23.592v2.364c0,0,4.762-1.22,4.762,1.183c0,7.095-11.905,7.058-11.905,7.058v2.365
    c0,0,14.323,0,14.323-9.423C38,21.227,30.82,23.592,30.82,23.592z"/>
    </g>
    </g>
    <g id="Cup">
    <g>
    <path fill="#F5F6F6" d="M32,21H13c0,0,0,2.156,0,2.573C13,31.399,15.381,39,22.523,39c7.106,0,9.524-7.601,9.524-15.427
    C32.048,23.083,32,21,32,21z"/>
    </g>
    </g>
    <g id="Steam" opacity="0.502">
    <g>
    <path fill="#F5F6F6" d="M24.887,11.873c1.551-3.309-2.487-4.885-2.487-4.885s1.992,2.226,0.354,4.229
    c-0.715,0.874-2.232,1.976-2.352,3.108c-0.379,3.6,3.71,5.227,3.71,5.227s-1.823-1.265-1.256-4.414
    C23.047,14.079,24.455,12.796,24.887,11.873z"/>
    </g>
    </g>
    </svg>
    
  %h3
    Customized
  
  <?xml version="1.0" encoding="utf-8"?>
  <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
  width="48px" height="48px" viewBox="0 0 48 48" enable-background="new 0 0 48 48" xml:space="preserve">
  <g id="BG_-_circle_99_">
  <g>
  <circle class="flatties-bg--email" fill="#A4BE60" cx="24" cy="24" r="24"/>
  </g>
  </g>
  <g id="Envelope_base">
  <g>
  <path fill="#FFFFFF" d="M37,14H11c-1.104,0-2,0.896-2,2v17c0,1.104,0.896,2,2,2h26c1.104,0,2-0.896,2-2V16
  C39,14.896,38.104,14,37,14z"/>
  </g>
  </g>
  <g id="Shade">
  <g>
  <path fill="#E8E8E8" d="M24,28L9,16v17c0,1.104,0.896,2,2,2h26c1.104,0,2-0.896,2-2V16L24,28z"/>
  </g>
  </g>
  <g id="Crease_1_">
  <g>
  <polygon fill="#C1C0C0" points="24,26 9.11,16 23.982,28.519 38.819,16     "/>
  </g>
  </g>
  </svg>
  
  <?xml version="1.0" encoding="utf-8"?>
  <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
  width="48px" height="48px" viewBox="0 0 48 48" enable-background="new 0 0 48 48" xml:space="preserve">
  <g id="BG_-_circle_79_">
  <g>
  <circle class="flatties-bg--beer" fill="#D3524D" cx="24" cy="24" r="24"/>
  </g>
  </g>
  <g id="Glass_3_" opacity="0.6392">
  <g>
  <path fill="#FFFFFF" d="M28.723,35.714L31,15H16l2.277,20.714c0,0-0.852,0.63-1.121,1.179c-0.29,0.593,0,1.107,0,1.107h12.723
  c0,0,0.287-0.54,0-1.107C29.588,36.316,28.723,35.714,28.723,35.714z"/>
  </g>
  </g>
  <g id="Peroni">
  <g>
  <polygon fill="#D68333" points="18,18 20,36 27,36 29,18     "/>
  </g>
  </g>
  <g id="Head">
  <g>
  <path fill="#FFFFFF" d="M23.663,15C20.859,15,18,15,18,15v3h11v-3C29,15,26.357,15,23.663,15z"/>
  </g>
  </g>
  <g id="Bubbles_1_" opacity="0.302">
  <g>
  <path fill="#FFFFFF" d="M23.5,32c-0.276,0-0.5,0.224-0.5,0.5s0.224,0.5,0.5,0.5s0.5-0.224,0.5-0.5S23.776,32,23.5,32z M22,28
  c-0.553,0-1,0.447-1,1s0.447,1,1,1s1-0.447,1-1S22.553,28,22,28z M24,24c-0.553,0-1,0.447-1,1s0.447,1,1,1s1-0.447,1-1
  S24.553,24,24,24z"/>
  </g>
  </g>
  </svg>
  
  <?xml version="1.0" encoding="utf-8"?>
  <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
  width="48px" height="48px" viewBox="0 0 48 48" enable-background="new 0 0 48 48" xml:space="preserve">
  <g id="BG_-_circle_52_">
  <g>
  <circle class="flatties-bg--coffee" fill="#D3524C" cx="24" cy="24" r="24"/>
  </g>
  </g>
  <g id="Handle_9_">
  <g>
  <path  class="flatties-coffee-handle" fill="#C8C7C7" d="M30.82,23.592v2.364c0,0,4.762-1.22,4.762,1.183c0,7.095-11.905,7.058-11.905,7.058v2.365
  c0,0,14.323,0,14.323-9.423C38,21.227,30.82,23.592,30.82,23.592z"/>
  </g>
  </g>
  <g id="Cup">
  <g>
  <path fill="#F5F6F6" d="M32,21H13c0,0,0,2.156,0,2.573C13,31.399,15.381,39,22.523,39c7.106,0,9.524-7.601,9.524-15.427
  C32.048,23.083,32,21,32,21z"/>
  </g>
  </g>
  <g id="Steam" opacity="0.502">
  <g>
  <path fill="#F5F6F6" d="M24.887,11.873c1.551-3.309-2.487-4.885-2.487-4.885s1.992,2.226,0.354,4.229
  c-0.715,0.874-2.232,1.976-2.352,3.108c-0.379,3.6,3.71,5.227,3.71,5.227s-1.823-1.265-1.256-4.414
  C23.047,14.079,24.455,12.796,24.887,11.873z"/>
  </g>
  </g>
  </svg>
  
  %h1 SVG Custom Flatties
  
  %p
    Font icons are rad because you can easily style them with CSS. The drawback is that you are restricted to basic things that CSS can do and applying those styles to the whole element.
  
  %p
    I thought it'd be worthwhile to try directly working with the SVGs for a hybrid approach. I'm going to mess with the
    %a(href="https://creativemarket.com/uiparade/4823-Flatties-flat-style-icon-set") Flatties Icon Set
    to see if you could customize all (well, all of a sub-set) of the backgrounds with a base class.
            
          
!
            
              @import compass

// -------------------------------------
//   Tinkering Base
// -------------------------------------

.explanation
  line-height: 1.5
  margin: 2em auto 0
  max-width: 700px
  width: 87.5%
  
  
// Just cause I hate the visited purple link.
a
  color: #b51f24

// -------------------------------------
//   Flatties
// -------------------------------------

// This applies an opacity change on hover, but is done to the whole SVG because otherwise you lose the hover when you're on internal elements.

svg:hover
  .flatties-bg
    fill-opacity: 0.6
    
// This sets a fill color and opacity level for the circles of the icons.

.flatties-bg
  fill: #e8c04f
  fill-opacity: 0.8
  
.flatties-bg--email
  @extend .flatties-bg
  
.flatties-bg--beer
  @extend .flatties-bg
  
.flatties-bg--coffee
  @extend .flatties-bg
    
// It can be applied to any piece of the SVG. Like the handle is too light on the yellow.

.flatties-coffee-handle
  fill: #ab8518
   
            
          
!
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