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.

            
              <h1>Sass Mixin for Links</h1>
<a href="#">This is a link</a>
<hr />
<p>The idea behind this mixin is that no defaults are declared in the arguments so that we are “forced” in a friendly way to declare all 4 states of our links.</p>
<p>The <code>:focus</code> and <code>:active</code> pseudo-classes are usually declared together. Feel free to separate them if you want to do so.</p>
<p>One note about this mixin, is that it can be applied to any HTML element, not only links.</p>
<hr />
<h2>Mixin:</h2>
<pre><code class="css">@mixin links ($link, $visited, $hover, $active) {
    & {
        color: $link;
        &:visited {
            color: $visited;
        }
        &:hover {
            color: $hover;
        }
        &:active, &:focus {
            color: $active;
        }
    }
}
</code></pre>
<h2>Usage:</h2>
<pre><code class="css">a {
    @include links(orange, blue, yellow, teal);
}</code></pre>
<h2>Compiles to:</h2>
<pre><code class="css">a {
  color: orange;
}
a:visited {
  color: blue;
}
a:hover {
  color: yellow;
}
a:active, a:focus {
  color: teal;
}</code></pre>
            
          
!
            
              //Links Mixin
@mixin links ($link, $visited, $hover, $active) {
    & {
        color: $link;
        &:visited {
            color: $visited;
        }
        &:hover {
            color: $hover;
        }
        &:active, &:focus {
            color: $active;
        }
    }
}

a { @include links(orange, blue, yellow, teal); }

//Styling not needed for demo
a {
    padding: 4px 10px;
    font-size: 20px;
    background: #444;
}
pre, code, p { text-align: left; }
code { background: none; box-shadow: none; font-size: 18px; }
h2 { text-align: left; }
* { font-weight: normal !important /*o_O*/; }



            
          
!
            
              /*Highlight.JS
https://highlightjs.org/
*/
hljs.initHighlightingOnLoad();
            
          
!
999px
Loading ..................

Console