Created
January 18, 2018 08:57
-
-
Save LuisSevillano/b6acc4a5c8ea8dc30360a1bb3f1291c3 to your computer and use it in GitHub Desktop.
Positioning triangles inside an element with CSS pseudo elements
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
.pill { | |
position: relative; | |
} | |
.pill::before { | |
content: ''; | |
position: absolute; | |
top: 50%; | |
left: 0; | |
right: 100%; | |
margin-top: -5px; | |
width: 0; | |
height: 0; | |
border-top: 5px solid transparent; | |
border-bottom: 5px solid transparent; | |
border-right: 5px solid black; | |
margin-left: 10px; | |
} | |
.pill::after { | |
content: ''; | |
position: absolute; | |
top: 50%; | |
right: 0; | |
margin-top: -5px; | |
width: 0; | |
height: 0; | |
border-top: 5px solid transparent; | |
border-bottom: 5px solid transparent; | |
border-left: 5px solid black; | |
margin-right: 10px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment