Created
March 11, 2024 22:27
-
-
Save bran921007/86464c01b5fbb1edbab32c11b0b6b96d to your computer and use it in GitHub Desktop.
Tooltip in CSS
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 { | |
--base: 2em; | |
--height: 1em; | |
--color: #09f; | |
border-image: | |
fill 0 / 0 / var(--height) | |
conic-gradient(var(--color) 0 0); | |
clip-path: | |
polygon(0 100%, 0 0, 100% 0, 100% 100%, | |
calc(50% + var(--base) / 2) 100%, | |
50% calc(100% + var(--height)), | |
calc(50% - var(--base) / 2) 100%); | |
padding: 1em; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment