Template:Tooltip/styles.css: Difference between revisions
Template page
More actions
TheMysterys (talk | contribs) Tooltip styles |
TheMysterys (talk | contribs) m Positioning styles |
||
Line 17: | Line 17: | ||
/* Position the tooltip text - see examples below! */ | /* Position the tooltip text - see examples below! */ | ||
bottom: 100%; | |||
left: 50%; | |||
margin-left: -60px; /* Use half of the width (120/2 = 60), to center the tooltip */ | |||
position: absolute; | position: absolute; | ||
z-index: 1; | z-index: 1; | ||
} | |||
/* Tooltip Arrow */ | |||
.tooltip .tooltiptext::after { | |||
content: " "; | |||
position: absolute; | |||
top: 100%; /* At the bottom of the tooltip */ | |||
left: 50%; | |||
margin-left: -5px; | |||
border-width: 5px; | |||
border-style: solid; | |||
border-color: black transparent transparent transparent; | |||
} | } | ||
Revision as of 05:36, 27 September 2023
/* Tooltip container */ .tooltip { position: relative; display: inline-block; border-bottom: 1px black; } /* Tooltip text */ .tooltip .tooltiptext { visibility: hidden; width: 120px; background-color: black; color: #fff; text-align: center; padding: 5px 0; border-radius: 6px; /* Position the tooltip text - see examples below! */ bottom: 100%; left: 50%; margin-left: -60px; /* Use half of the width (120/2 = 60), to center the tooltip */ position: absolute; z-index: 1; } /* Tooltip Arrow */ .tooltip .tooltiptext::after { content: " "; position: absolute; top: 100%; /* At the bottom of the tooltip */ left: 50%; margin-left: -5px; border-width: 5px; border-style: solid; border-color: black transparent transparent transparent; } /* Show the tooltip text when you mouse over the tooltip container */ .tooltip:hover .tooltiptext { visibility: visible; }