/* ------------------------------------------------------------- 08/02/2023 - * .tooltip - https://codepen.io/tippingpointdev/pen/QWMvwKx Tooltip (top) Tooltip (bottom) Tooltip (right) Tooltip (left) * -------------------------------------------------------------------------- */ $tooltipColor: White; $tooltipBackg: DeepPink; .tooltip { position: relative; &::before, &::after { font-weight: bolder; line-height: 1; position: absolute; opacity: 0; visibility: hidden; transition: opacity .3s ease-in-out; } &:hover::before, &:hover::after { opacity: 1; visibility: visible; } &::before { z-index: 999; /* höchster z-index auf Site */ content: attr(data-tooltip); white-space: nowrap; font-size: small; //max-width: 260px; color: $tooltipColor; background-color: $tooltipBackg; border-radius: 3px; padding: 5px; } &::after { content: ''; width: 0; height: 0; } /* ---------------------------------- * * tooltip--top * ---------------------------------- */ &.tooltip--top::before, &.tooltip--top::after { bottom: 100%; left: 50%; transform: translate(-50%); margin-bottom: 15px; } &.tooltip--top::after { margin-bottom: 8px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 7px solid $tooltipBackg; } /* ---------------------------------- * * tooltip--bottom * ---------------------------------- */ &.tooltip--bottom::before, &.tooltip--bottom::after { top: 100%; left: 50%; transform: translate(-50%); margin-top: 15px; } &.tooltip--bottom::after { margin-top: 8px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 7px solid $tooltipBackg; } /* ---------------------------------- * * tooltip--right * ---------------------------------- */ &.tooltip--right::before, &.tooltip--right::after { top: 50%; left: 100%; transform: translate(0, -50%); margin-left: 15px; } &.tooltip--right::after { margin-left: 8px; border-top: 5px solid transparent; border-right: 7px solid $tooltipBackg; border-bottom: 5px solid transparent; } /* ---------------------------------- * * tooltip--left * ---------------------------------- */ &.tooltip--left::before, &.tooltip--left::after { top: 50%; right: 100%; transform: translate(0, -50%); margin-right: 15px; } &.tooltip--left::after { margin-right: 8px; border-top: 5px solid transparent; border-left: 7px solid $tooltipBackg; border-bottom: 5px solid transparent; } } /* .tooltip */