Created
May 12, 2020 18:45
-
-
Save hodonsky/a3570dfe2b6045aba67fb487b35a318f to your computer and use it in GitHub Desktop.
Weird CSS Triangle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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 ) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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