-
-
Save dandelionadia/906de861260eb9fc654312bb1d669d1c to your computer and use it in GitHub Desktop.
Tooltip tick via pseudo-elements
This file contains 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
.tooltip { | |
position: absolute; | |
top: 100%; | |
left: 0; | |
width: 100%; | |
max-width: 350px; | |
padding: 0.5rem 1rem; | |
background-color: #fff; | |
border: 1px solid #000; | |
border-radius: 4px; | |
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); | |
font-size: 0.85rem; | |
z-index: 1; | |
&::before { | |
--size: 8px; | |
position: absolute; | |
content: ''; | |
top: calc(var(--size) * -2); | |
left: 0; | |
right: 0; | |
height: 0; | |
width: 0; | |
margin: auto; | |
border-width: var(--size); | |
border-style: solid; | |
border-color: transparent transparent #fff; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment