Template:Tooltip/styles.css: Difference between revisions

Content deleted Content added
No edit summary
Tag: Reverted
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1:
/* {{pp-template}} */
/* Keep same inline look; we only add a pseudo tooltip */
.tooltip { position: relative; cursor: help; }
 
/* Base: keep desktop exactly the same */
/* Dotted option without text-underline-offset */
.tooltip-dotted { border-bottomposition: 1pxrelative; dotteddisplay: currentColorinline; }
.tooltip-dotted a,{ border-bottom: 1px dotted; cursor: help; }
.tooltip-dotted .rt-commentedText { border-bottom: inherit; }
 
/* --- Mobile-only synthesized tooltip (no pointer-events used) --- */
/* Draw tooltip using the attribute text; no native title anymore */
@media (hover: none) and (pointer: coarse) {
.tooltip::after {
content: attr(data-title);
position: absolute;
left: 0;
top: 100%;
margin-top: 6px;
padding: 6px 8px;
background: #222;
color: #fff;
border-radius: 6px;
font-size: 0.875em;
line-height: 1.35;
max-width: 90vw;
box-shadow: 0 8px 24px rgba(0,0,0,.25);
z-index: 1000;
 
/* Bubble text pulled from the existing title attribute */
opacity: 0;
.tooltip[title]::after {
visibility: hidden;
content: attr(data-title);
position: absolute;
left: 050%;
bottom: calc(100% + 8px);
transform: translateX(-50%);
z-index: 1000;
 
background: #222rgba(0,0,0,0.85);
/* Show on hover (desktop) */
color: #fff;
.tooltip:hover::after { opacity: 1; visibility: visible; }
padding: 6px 8px;
border-radius: 6px4px;
box-shadow: 0 8px2px 24px6px rgba(0,0,0,0.253);
line-height: 1.352;
font-size: 0.875em;
max-width: 90vw26rem;
white-space: normal;
text-align: left;
 
opacity: 0;
/* Show on focus (click/tap for non-links with tabindex=0) */
.tooltip:focus::after { opacity: 1; visibility: visiblehidden; }
}
 
/* Arrow */
.tooltip[title]::before {
content: "";
position: absolute;
left: 50%;
bottom: calc(100% + 2px);
transform: translateX(-50%);
border: 6px solid transparent;
border-top-color: rgba(0,0,0,0.85);
 
opacity: 0;
visibility: hidden;
}
 
/* Non-link: the <span> itself is focusable (tabindex=0) */
.tooltip:focus::after,
.tooltip:focus::before,
.tooltip:active::after,
.tooltip:active::before {
opacity: 1;
.tooltip:hover::after { opacity: 1; visibility: visible; }
}
 
/* Link case: focus/active land on the surrounding <a> */
a:focus > .tooltip[title]::after,
a:focus > .tooltip[title]::before,
a:active > .tooltip[title]::after,
a:active > .tooltip[title]::before {
opacity: 1;
visibility: visible;
}
 
/* Reduced-motion users (nothing to transition here, so nothing needed) */
/* Basic focus ring; outline-offset is not allowed, so keep it simple */
.tooltip:focus { outline: 2px solid #99c2ff; }