<h1>Delta ribbon</h1>
<nav class="ribbon ribbon--delta" role="navigation" aria-label="breadcrumbs">
  <a class="ribbon__element" href="https://www.silvestar.codes/" target="_blank">Home</a>
  <a class="ribbon__element" href="https://www.silvestar.codes/categories/articles/" target="_blank">Blog</a>
  <a class="ribbon__element" href="https://www.silvestar.codes/articles/building-an-animated-sticky-header-with-custom-offset/" aria-current="page" target="_blank">Post</a>
</nav>
<h3><a href="https://codepen.io/collection/DmwMyr/" target="_blank">A ribbon collection</a></h3>
<p><a href="https://www.silvestar.codes/" target="_blank">silvestar.codes</a> 🤘 <a href="https://play.silvestar.codes/ribbon/" target="_blank">SB Playground</a></p>
// Dirty reset
* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

// Variables
$c0: #343435;
$c1: lighten(#0fba84, 5%);
$c2: lighten(#e01258, 10%);
$c3: lighten(#1ec9e4, 10%);
$c9: #fff;

// Global style
body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: $c0;
  min-height: 100vh;
  padding: 10px;
  font-family: 'Barlow', sans-serif;
}

h1,
h3,
p {
  margin-top: 2em;
  
  a {
    color: $c2;
    text-decoration: none;
    
    &:hover {
      color: darken($c2, 10%);
      text-decoration: underline;
    }
  }
}

// Ribbon
.ribbon {
  display: grid;
  font-size: 15px;
  grid-gap: 1px;
  grid-template-columns: repeat(3, 1fr) 1em;
  margin-left: auto;
  margin-right: auto;
  margin-top: 1em;
  width: 100%;
}

.ribbon--small {
  font-size: 10px;
}

.ribbon--big {
  font-size: 20px;
}

.ribbon__element {
  background-color: $c1;
  color: $c9;
  font-size: 1.5em;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.333em;
  padding: 0.667em 0.667em 0.667em 1.333em;
  position: relative;
  text-decoration: none;

  &:nth-child(1) {
    background-color: $c1;
    z-index: 3;
  }

  &:nth-child(2) {
    background-color: $c2;
    z-index: 2;
  }

  &:nth-child(3) {
    background-color: $c3;
    z-index: 1;
  }

  .ribbon--delta & {
    clip-path: polygon(95% 0, 100% 50%, 95% 100%, 0% 100%, 5% 50%, 0% 0%);
    // padding: 0.667em 0.667em 0.667em 1em;
    
    &:not(:last-child) {    
      width: 105%;
    }

    &:last-child {    
      width: calc(100% + .667em);
    }
  }

  .ribbon--shadow & {
    box-shadow: 1px 3px 3px -3px black;
  }

  .ribbon--gradient & {
    &:nth-child(1) {
      background-image: linear-gradient(to right, adjust-hue($c1, 7deg), $c1);
    }

    &:nth-child(2) {
      background-image: linear-gradient(to right, adjust-hue($c2, 7deg), $c2);
    }

    &:nth-child(3) {
      background-image: linear-gradient(to right, adjust-hue($c3, 7deg), $c3);
    }
  }

  &:hover,
  &:active {
    color: inherit;
    text-decoration: underline;
  }
  
  &:focus {
    box-shadow: 0 -3px 0 0 $c0 inset;
    outline: none;
  }

  &:visited {
    color: $c9;
  }
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.