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.

              <h1>Wrap-around ribbons with Sass</h1>
<hr />
<div class="wrapper">
    <div class="basic">
        <div class="container b1">Left ribbon</div>
        <div class="container b2">Right ribbon</div>
        <div class="container b3">Both ribbons</div>
    <div class="implemented ">
        <div class="demo simple">
            <h2>Wrap-Around Ribbons</h2>
            <div class="box">
                <p>Basic Example</p>
        <div class="demo fancy">
            <h2>Wrap-around Ribbons</h2>
            <div class="box">
                <p>Fancy Example</p>
<hr />
<p>Created by <a href="http://ricardozea.design/?=codepen" target="_blank" title="Link opens in a new tab">Ricardo Zea</a></p>
              //Put this whole mixin in your .scss file:
@mixin ribbon( $ribbon-color:black, $size-left:1em, $size-right:1em) {
    position: relative;
    &:after {
        content: "";
        position: absolute;
    &:before {
        border-top: $size-left solid $ribbon-color;
        bottom: -$size-left;
        border-left: $size-left solid transparent;
        left: 0;
    &:after {
        border-top: $size-right solid $ribbon-color;
        bottom: -$size-right;
        border-right: $size-right solid transparent;
        right: 0;

.selector { @include ribbon($y, 1em, 0); }

Explanation of mixin values:
A. $y: Is the color, I used a Sass variable but you can use whatever you want: #f00 - red - #ff0000
B. 1em: Is the dimensions of the ribbon(s)
C. "1em, 0": Means you're only doing the ribbon on the left
D. "0, 1em": Means you're only doing the ribbon on the right
E. "1em, 1em": Means you're  doing both ribbons  on left and right

//This is the container to which you're going to apply the ribbon to
.container {
    display: inline;
    margin: 0 2%;
    padding: 40px 20px;
    background: $b;

//These are the ribbons themselves:

//Left ribbon
.b1 { @include ribbon($y, 1em, 0); }

//Right ribbon
.b2 { @include ribbon($y, 0, 1em); }

//Both ribbons
.b3 { @include ribbon($y, 1em, 1em); }


//Demos on the right side with red headers
.demo {
    margin-bottom: 20px;
    &:last-of-type {
        margin: 0;

//The red headings use the ribbons, see @include property below
h2 {
    @include ribbon(darken($r, 30%), 15px, 15px);
    width: 300px;
    margin: auto;
    padding: 2%;
    background: $r;

//Blue boxes under the header
.box {
    width: 270px;
    margin: auto;
    padding: 4%;
    clear: both;
    background: $g;
    box-shadow: inset 0 3px 0 rgba(black, .2);
    font-weight: bold;

//Gradient box, fancier-looking demo
.fancy {
    text-shadow: 0 -1px 0 rgba(black, 1);
    h2 {
        background-image: linear-gradient($r, darken($r, 20%));
        box-shadow: 0 2px 2px 1px rgba(black, .2);
    .box {
        border-radius: 0 0 5px 5px;
        background-image: linear-gradient(darken($b, 25%), darken($b, 30%));
        box-shadow: 0 2px 4px 1px rgba(black, .2);

//***********NOT NEEDED FOR DEMO***********
.wrapper {
    display: flex;
    & > div {
        padding: 20px 20px 30px;
        margin: 10px;
        background: rgba(white, .05);
        display: inline-block;
        width: 100%;
        border: rgba(white, .06) 1px solid;
        border-radius: 2px;
        box-shadow: 0 2px 2px rgba(black, .1);

.basic {
    display: flex !important;
    align-items: center;
    justify-content: space-around;
    width: auto;

.new-window {
    position: relative;
    padding-right: 16px;
    &:after {
        content: '';
        display: block;
        width: 14px;
        height: 12px;
        position: absolute;
        top: 10%;
        right: 0;
        background: url(https://i.stack.imgur.com/3H2PQ.png) no-repeat;
Original Article:

Inspired by this article:


//Add a title to the links that open in a new tab/window
$("a[target='_blank']").attr({title:'Opens in a new tab/window'}).addClass('new-window');

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