Skip to content

Instantly share code, notes, and snippets.

@hodonsky
Created May 12, 2020 18:45
Show Gist options
  • Save hodonsky/a3570dfe2b6045aba67fb487b35a318f to your computer and use it in GitHub Desktop.
Save hodonsky/a3570dfe2b6045aba67fb487b35a318f to your computer and use it in GitHub Desktop.
Weird CSS Triangle
.body{
width: 400px;
height: 400px;
}
.triangle {
position: relative;
margin: 0 auto;
width: 20px;
height:20px;
}
.left, .right{
background-color: darkgrey;
width: 20px;
height: 20px;
position: absolute;
}
.left{
transform: translateX(3px) rotate(58deg);
border-right: thin solid red;
}
.right{
transform: translateX(-3px) rotate(32deg);
border-bottom: thin solid red;
}
.mask{
background-color: white;
width: 40px;
height: 20px;
position: absolute;
transform: translate( -10px, -6px )
}
<div class="body">
<div class="triangle">
<div class="left"></div>
<div class="right"></div>
<div class="mask"></div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment