Skip to content

Instantly share code, notes, and snippets.

@JetFault
Forked from anonymous/index.html
Last active August 29, 2015 14:07
Show Gist options
  • Save JetFault/8fd857bc993601ac30d0 to your computer and use it in GitHub Desktop.
Save JetFault/8fd857bc993601ac30d0 to your computer and use it in GitHub Desktop.
CSS Stacking Triangles
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
.tri {
margin-top: 50px;
}
.plus, .minus {
display: inline-block;
position: relative;
}
.plus {
width: 0px;
height: 0px;
border-style: solid;
border-width: 34px 34px 0 0;
border-color: #076591 transparent transparent transparent;
}
.minus {
width: 0px;
height: 0px;
border-style: solid;
border-width: 0 0 34px 34px;
border-color: transparent transparent #076591 transparent;
left: -36px;
top: 2px;
}
.minus::after {
content: "-";
position: absolute;
right: 6px;
top: 12px;
}
.plus::after {
content: "+";
position: absolute;
bottom: 12px;
left: 6px
}
.plus::after, .minus::after {
font-size: 20px;
color: white;
}
</style>
</head>
<body>
<div class="tri">
<a href="#plus" class="plus"></a>
<a href="#minus" class="minus"></a>
</div>
<script id="jsbin-source-css" type="text/css">.tri {
margin-top: 50px;
}
.plus, .minus {
display: inline-block;
position: relative;
}
.plus {
width: 0px;
height: 0px;
border-style: solid;
border-width: 34px 34px 0 0;
border-color: #076591 transparent transparent transparent;
}
.minus {
width: 0px;
height: 0px;
border-style: solid;
border-width: 0 0 34px 34px;
border-color: transparent transparent #076591 transparent;
left: -36px;
top: 2px;
}
.minus::after {
content: "-";
position: absolute;
right: 6px;
top: 12px;
}
.plus::after {
content: "+";
position: absolute;
bottom: 12px;
left: 6px
}
.plus::after, .minus::after {
font-size: 20px;
color: white;
}</script>
</body>
</html>
.tri {
margin-top: 50px;
}
.plus, .minus {
display: inline-block;
position: relative;
}
.plus {
width: 0px;
height: 0px;
border-style: solid;
border-width: 34px 34px 0 0;
border-color: #076591 transparent transparent transparent;
}
.minus {
width: 0px;
height: 0px;
border-style: solid;
border-width: 0 0 34px 34px;
border-color: transparent transparent #076591 transparent;
left: -36px;
top: 2px;
}
.minus::after {
content: "-";
position: absolute;
right: 6px;
top: 12px;
}
.plus::after {
content: "+";
position: absolute;
bottom: 12px;
left: 6px
}
.plus::after, .minus::after {
font-size: 20px;
color: white;
}
@JetFault
Copy link
Author

JetFault commented Oct 6, 2014

Anchor references are broken as they are not triangles, needs JS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment