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.

            
              .wrapper
  %h1
    Embedding icons from Font Awesome
  %p
    Sometimes you will need to have icons only when an event is triggered. You might use an empty element to do that, this mixin is to avoid the use of that technique.
.wrapper 
  %h2
    &:before
  - @menuItems = ['Date (Old)','Date (New)','Name (A-Z)','Name (Z-A)']
  %ul.list
    - @menuItems.each do |item|
      %li.list-item
        %a.list-item__lnk.-thm-1.js-active{:href=>"#"}
          #{item}
.wrapper
  %h2
    &:after
    %ul.list
      - @menuItems.each do |item|
        %li.list-item
          %a.list-item__lnk.-thm-2.js-active{:href=>"#"}
            #{item}
            
          
!
            
              $pull-unit: 1.1rem;

@mixin embed-icon($code_icon, $fontSize:auto, $color: inherit, $position: before){
  @if($code_icon == ""){
    $code_icon:  'No icon defined';
    $color: red;
  }
  //The styles from FontAwesome
  display: inline-block;
  font-family: FontAwesome;
  font-style: normal;
  font-weight: normal;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  &:#{$position}{  
    position: relative;
    content:'#{$code_icon}';
    font-size: $fontSize;
    color: $color;
    margin-left: -($pull-unit);//Pull the icon
    @if ($position == after){
      margin-left: 0;
    }
  }
}


body {
  background: #f3f3f3;
  font-family: 'Open Sans', sans-serif;
}
.wrapper{
  width: 500px;
  margin: 10px auto;
  padding: 1rem;
  > h1{
    font-size: 1.3rem;
    line-height: 2rem;
  }
  > p{
    font-size: .9rem;
    line-height: 1.2rem;
    color: grey;
  }
}
.list{
  width: 100%;
  margin:  1rem auto;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

.list-item{
  padding: .5rem 1rem;
}
.list-item__lnk{
  position: relative;
  text-decoration: none;
  font-size: .9rem;
  color: grey;
  font-weight: normal;
  -webkit-font-smoothing: antialiased;

  &.-thm-1{
    margin-left: $pull-unit;//Leaving space for icon
    &.-current{
      @include embed-icon('\f00c', 1em, green, before);
    }
  }
  &.-thm-2{
    &.-current{
      @include embed-icon('\f00a', 1em, orange, after);
    }
  }
}



            
          
!
            
              $('.js-active').on 'click', (e)->
  e.preventDefault()
  $('.js-active').removeClass '-current'
  $(@).addClass '-current'
            
          
!
999px
Loading ..................

Console