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

              
                <h1>CSS Arrows/Triangles Combinations</h1>
<ol class="multiple-triangles">
   <li><div class="side1"></div></li>
   <li><div class="side2"></div></li>
   <li><div class="all4"></div></li>
   <li><div class="top-n-bottom"></div></li>
   <li><div class="left-n-right"></div></li>
   <li><div class="side1 vertical"></div></li>
   <li class="top-bottom-separated pos-ab-element">
      <div class="north"></div>
      <div class="south"></div>
   </li>
   <li class="west-east-separated pos-ab-element">
      <div class="west"></div>
      <div class="east"></div>
   </li>
</ol>
<ol class="diagonal-triangles">
   <li><div class="top-right"></div></li>
   <li><div class="bottom-right"></div></li>
   <li><div class="bottom-left"></div></li>
   <li><div class="top-left"></div></li>
</ol>
<ol class="extra straight-triangles">
   <li><div class="north"></div></li>
   <li><div class="east"></div></li>
   <li><div class="south"></div></li>
   <li><div class="west"></div></li>
</ol>
<p>Check out this other demo: <a href="https://codepen.io/ricardozea/pen/30a046dec7d990b1651931d0c1300f6b">CSS Shapes with Sass</a></p>
<hr>
<p>Created by <a href="http://ricardozea.design/" target="_blank" title="Link opens in a new tab">Ricardo Zea</a></p>
              
            
!

CSS

              
                //Color variables (need to go at the on top):
$MyBlack: #272822;
$r: #c03;
$g: #429032;
$b: #2963bd;
$y: #c90;

//======

//Demo stuff - Edit below this line
div {
   margin-bottom: 20px;
   //Boxes or Triangle Combinations
   &.side1 {
      height: 0;
      width: 0;
      border-top: 100px solid $r;
      border-right: 100px solid $b;

      //Vertical
      &.vertical {
         transform: rotate(45deg);
         margin-top: 20px;
      }
   }

   &.side2 {
      height: 0;
      width: 0;
      border-bottom: 100px solid $g;
      border-right: 100px solid $y;
   }

   &.all4 {
      border-style: solid;
      border-width: 50px;
      border-bottom-color: $b;
      border-left-color: $g;
      border-top-color: $y;
      border-right-color: $r;
      height: 0;
      width: 0;
   }

   &.top-n-bottom {
      border-style: solid;
      border-width: 50px;
      border-bottom-color: $b;
      border-left-color: transparent;
      border-top-color: $y;
      border-right-color: transparent;
      height: 0;
      width: 0;
   }

   &.left-n-right {
      border-style: solid;
      border-width: 50px;
      border-bottom-color: transparent;
      border-left-color: $g;
      border-top-color: transparent;
      border-right-color: $r;
      height: 0;
      width: 0;
   }

   //Arrows - Diagonal
   &.top-right {
      height: 0;
      width: 0;
      border-top: 100px solid $g;
      border-left: 100px solid transparent;
   }

   &.bottom-right {
      height: 0;
      width: 0;
      border-bottom: 100px solid $r;
      border-left: 100px solid transparent;
   }

   &.bottom-left {
      height: 0;
      width: 0;
      border-bottom: 100px solid $b;
      border-right: 100px solid transparent;
   }

   &.top-left {
      height: 0;
      width: 0;
      border-top: 100px solid $y;
      border-right: 100px solid transparent;
   }

   //Arrows - Straight
   &.north {
      height: 0;
      width: 0;
      border-top: 100px solid $g;
      border-left: 100px solid transparent;
      transform: rotate(-45deg);
   }

   &.east {
      height: 0;
      width: 0;
      border-bottom: 100px solid $r;
      border-left: 100px solid transparent;
      transform: rotate(-45deg);

      //Only needed for demo
      margin-left: -50px;
   }

   &.south {
      height: 0;
      width: 0;
      border-bottom: 100px solid $b;
      border-right: 100px solid transparent;
      transform: rotate(-45deg);

      //Only needed for demo
      margin-top: -20px;
   }

   &.west {
      height: 0;
      width: 0;
      border-top: 100px solid $y;
      border-right: 100px solid transparent;
      transform: rotate(-45deg);
   }
}

//Top and Bottom separated
.top-bottom-separated {
   position: relative;
   margin-right: 170px;
   div {
      position: absolute;
      margin: 0;
   }
   .south {
      border-bottom: 100px solid $y;
      top: 40px;
   }

   //Only needed for demo
   .north {
      margin-top: 10px;
   }
}

//West and East separated
.west-east-separated {
   position: relative;
   div {
      position: absolute;
      margin: 0;
   }
   .east {
      border-bottom: 100px solid $r;
      top: 28px;
      left: 10px;
   }

   //Only needed for demo
   .west {
      margin-top: 10px;
   }
}

//Styling stuff not needed for demo

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
body {
   background-image: radial-gradient(lighten($MyBlack, 5), $MyBlack 150%);
   color: white;
   text-align: center;
   font-family: "Trebuchet MS";
}
h1 { font-weight: 100; }
a,
a:visited {
   color: $b;
   transition: .3s;
}
a:hover {
   color: $y;
   text-decoration: none;
}
ol {
   display: flex;
   flex-wrap: wrap;
   padding: 10px 10px 10px 35px;
   margin: 60px;
   list-style-type: lower-alpha;
   border: #333 1px solid;
   background: $MyBlack;
   border-radius: 2px;
   box-shadow: 0 0 5px rgba(black, 0.2);
   position: relative;
   &::before {
      display: inline-block;
      width: 100%;
      padding: 5px 10px;
      border-radius: 2px;
      content: "yes";
      position: absolute;
      top: -32px;
      left: 0;
      text-align: left;
      background: #111;
   }
   li {
      margin-right: 70px;
      &:last-of-type { margin: 0; }
   }
   &.extra { padding-top: 30px; }
}
.multiple-triangles::before { content: "Multiple Triangles:"; }
.diagonal-triangles::before { content: "Diagonal Triangles:"; }
.straight-triangles::before { content: "Straight Triangles:"; }

hr {
   width: 90%;
   margin: 30px auto;
   border: none;
   border-top: #666 1px dotted;
}

.pos-ab-element {
   width: 23px;
   height: 165px;
}
              
            
!

JS

              
                
              
            
!
999px

Console