Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="thanks">
  Special thanks to <a href="http://getdigital.de"><span>get</span>Digital</a> for the Product Images.
</div>

<article>
  <div class="tag" data-id="1" data-tagname="STAR WARS"></div>
  <hgroup>
    <h2>Awesome Star Wars Cup</h2>
      <img src="http://www.getdigital.de/web/getdigital/gfx/products/__generated__resized/1100x1100/R2D2_Relief_Mug_Titel.jpg" alt="" />
  </hgroup>
  <p>(img via <a href="http://www.getdigital.de/R2D2-3D-Relief-Becher.html">getDigital.de</a>)</p>
</article>


<article>
  <div class="tag"  data-id="2" data-tagname="STAR TREK"></div>
  <hgroup>
    <h2>Star Trek Bottle Opener</h2>
      <img src="http://www.getdigital.de/web/getdigital/gfx/products/__generated__resized/1100x1100/StarTrekFlaschenoeffnerAction.jpg" alt="" />
  </hgroup>
  <p>(img via <a href="http://www.getdigital.de/Star-Trek-Flaschenoeffner.html">getDigital.de</a>)</p>
</article>

<article>
  <div class="tag"  data-id="3" data-tagname="SUPER LONG TAG NAME"></div>
  <hgroup>
    <h2>Companion Cube &hearts;</h2>
      <img src="http://www.getdigital.de/web/getdigital/gfx/products/__generated__resized/1100x1100/companion_cube.jpg" alt="" />
  </hgroup>
  <p>(img via <a href="http://www.getdigital.de/Pac-Man-Waeme-Becher.html">getDigital.de</a>)</p>
</article>


<article>
  <div class="tag"  data-id="4" data-tagname="RASPBERRY PI"></div>
  <hgroup>
    <h2>Raspberry Pi</h2>
      <img src="http://www.getdigital.de/web/getdigital/gfx/products/__generated__resized/1100x1100/RaspberryPi_titel.jpg" alt="" />
  </hgroup>
  <p>(img via <a href="http://www.getdigital.de/Pac-Man-Waeme-Becher.html">getDigital.de</a>)</p>
</article>


<article>
  <div class="tag"  data-id="4" data-tagname="Nerd KIDZ"></div>
  <hgroup>
    <h2>Hello World Baby Body</h2>
      <img src="http://www.getdigital.de/web/getdigital/gfx/products/__generated__resized/1100x1100/helloworldstrampler.jpg" alt="" />
  </hgroup>
  <p>(img via <a href="http://www.getdigital.de/Hello-World-Baby-Body.html">getDigital.de</a>)</p>
</article>


<article>
  <div class="tag"  data-id="2" data-tagname="have you tried?"></div>
  <hgroup>
    <h2>Standard IT Response</h2>
      <img src="http://www.getdigital.de/web/getdigital/gfx/products/__generated__resized/1100x1100/turningitoff.jpg" alt="" />
  </hgroup>
  <p>(img via <a href="http://www.getdigital.de/Turning-it-off-and-on-again.html">getDigital.de</a>)</p>
</article>



<article>
  <div class="tag"  data-id="5" data-tagname="Now it's your turn!"></div>
  <hgroup>
    <h2>Go to the HTML Tab</h2>
  </hgroup>
  <p>You can change the Text inside each of the product flags by changing the value of <code>data-tagname</code>. The Color is controlled via <code>data-id</code> and the CSS (see line 81 and folowing).</p>
</article>



<article>
  <div class="tag"  data-id="5" data-tagname="POST OR IT DIDN'T HAPPEN"></div>
  <hgroup>
    <h2>Step by Step</h2>
  </hgroup>
  <p>I wrote an article on my Blog about the idea behind those product flags, why they're set up with <code>data-attributes</code> and how they work.</p>
  <p>You can read the aricle <a href="https://kevingimbel.com/pseudo-product-flags">here</a>.</p>
</article>
              
            
!

CSS

              
                @import "compass/css3";

$color-1: #f1c40f;
$color-2: #e74c3c;
$color-3: #2ecc71;
$color-4: #1abc9c;
* {
  margin:0;
  padding:0;
  @include box-sizing(border-box);
}

body {
  font:1rem/1 white Arial, Helvetica, sans-serif;
  width:100%;
  min-height:100%;
  @include background(linear-gradient(-45deg,#111,#333,#555,#777,#999));
}


article {
  width:33.3333%;
  min-width:15em;
  max-width:20em;
  color:black;
  border:1px solid #ccc;
  margin:1.5em;
  float:left;
  position:relative;
  
  @include border-radius(3px);
  background:#f1f1f1;
  hgroup {
    h2 {
      margin:.2em 0;
      padding:1.5em .5em 0 .5em;
    }
    img {
      width:100%;
    }
  }
  
  p {
    padding:.5em;
    font-size:70%;
  }
  
  a {
    color:#333;
    
      &:hover {
        color:grey;
      }
  }
}

  // general styling for each tag (no matter what ID or Name it has
  .tag {
    width:auto;
    height:auto;
    position:absolute;
    top:-1em;
    left:-1px; /* correction because of the border applied to <article> */
    background:#8e44ad; // standard background if there's no data-id
    padding:.5em;
    
    &:before {
      content:attr(data-tagname);
    }
    // there's always a triangle behind it
    &:after {
      content:"";
      position:absolute;
      left:100%;
      top:0;
      width:0;
      height:0;
      border-top:1em solid transparent;
      border-left:1em solid darken(#8e44ad,20%);
      z-index:-1; /* correction because of the border applied to <article> */
    }
    
  
    // the data-id controls the colors
    &[data-id="1"] {
      background:$color-1;
      &:after {
        border-left-color:darken($color-1,20%);
      }
    }
    
    &[data-id="2"] {
      background:$color-2;
      
      &:after {
        border-left-color:darken($color-2,20%);
      }
    }
    
    
    &[data-id="3"] {
      background:$color-3;
      
      &:after {
        border-left-color:darken($color-3,20%);
      }
    }
    
    &[data-id="4"] {
      background:$color-4;
      
      &:after {
        border-left-color:darken($color-4,20%);
      }
    }
  
    &[data-id="5"] {
      background:#9e9e9e;
      color:white;
      
      &:after {
        border-left-color:darken(#9e9e9e,20%);
      }
    
    ~ p {
      font-size:90%;
    }
    }
  
  } // tag


.thanks {
  position:fixed;
  bottom:0;
  right:0;
  font-size:70%;
  width:10em;
  height:auto;
  padding:.5em;
  line-height:1.2;
  color: #fff;
  a {
    color:white;
    background:black;
    padding:.09em .4em;
    &:hover {
      text-decoration:none;
    }
   span {
    color:$color-1;
  }
 }
}
              
            
!

JS

              
                
              
            
!
999px

Console