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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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>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>
            
          
!
            
              //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;
}
            
          
!
999px
Loading ..................

Console