Difference between revisions of "Template:Tt"

From Detective Conan Wiki
(Undo revision 393928 by Tsutomu25 (talk))
(Tag: Undo)
 
(23 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly><span class="hover-text">{{{1}}}<span class="tooltip-container"><span class="tooltip"><span class="tooltip-text-container"><span>{{{2}}}</span></span></span></span></span>
+
<includeonly><span class="tt-target">{{{1}}}<span class="tt-container tt-container-above" style="display: none;"><span class="tt-tooltip">{{{2}}}<span class="tt-chevron"></span></span></span></span>{{code
{{css|
+
|css=
     .hover-text {
+
    /* Target word for the tooltip to focus on */
      display: inline-block;
+
     .tt-target {
      position: relative;
+
        position: relative;
      text-decoration: underline dotted;
+
        display: inline-block;
 +
        border-bottom: 0.0625em dotted;
 +
        cursor: help;
 
     }
 
     }
 
+
   
     .hover-text:hover .tooltip-container {
+
   
      opacity: 1;
+
    /* CONTAINER CLASSES */
      pointer-events: auto;
+
    /* A so-called 'container' for the tooltip to work around in */
 +
     .tt-container {
 +
        position: absolute;
 +
        left: 50%;
 +
        min-height: 1em;
 +
        width: 170px;
 +
        padding: 10px 0 8px;
 +
        display: flex;
 +
        justify-content: center;
 +
        opacity: 0;
 +
        z-index: 999;
 +
        pointer-events: none;
 +
        user-select: none;
 +
        -webkit-user-select: none;
 +
        -ms-user-select: none;
 +
        transition: 0.3s ease 0.1s; /* This is used for the hover animations */
 +
    }
 +
   
 +
    /* Container appear above target */
 +
    .tt-container-above {
 +
        bottom: calc(100% - 2px);
 +
        transform: translate(-50%, 3px);
 +
    }
 +
   
 +
    /* Container appear below target */
 +
    .tt-container-below {
 +
        top: calc(100% - 2px);
 +
        transform: translate(-50%, -3px);
 +
    }
 +
    /* END OF CONTAINER CLASSES */
 +
   
 +
   
 +
    /* The TOOLTIP itself */
 +
    .tt-tooltip {
 +
        background: #fff;
 +
        border-radius: 4px;
 +
        filter: drop-shadow(0 1px 4px rgba(0,0,0,0.6));
 +
        padding: 6px 9px;
 +
        text-align: center;
 +
        overflow-wrap: anywhere;
 +
    }
 +
   
 +
   
 +
    /* CHEVRON CLASSES */
 +
    /* Shared class */
 +
    .tt-chevron {
 +
        position: absolute;
 +
        left: 50%;
 +
        transform: translateX(-50%);
 +
        width: 0;
 +
        height: 0;
 +
        border-style: solid;
 +
        z-index: 998;
 
     }
 
     }
 
+
   
     .tooltip-container {
+
    /* When tooltip is above */
      opacity: 0;
+
     .tt-container-above .tt-chevron {
      pointer-events: none;
+
        top: calc(100% - 3px);
      transition: opacity .3s ease
+
        border-width: 9px 9px 0 9px;
 +
        border-color: #fff transparent transparent transparent;
 
     }
 
     }
 
+
   
     .tooltip {
+
    /* When tooltip is below */
      position: absolute;
+
     .tt-container-below .tt-chevron {
      bottom: 100%;
+
        bottom: calc(100% - 2px);
      left: 50%;
+
        border-width: 0 9px 9px 9px;
      background: #fff;
+
        border-color: transparent transparent #fff transparent;
      color: #222;
 
      padding: 4px 8px;
 
      border: 1px solid #a9caf3;
 
      border-radius: 4px;
 
      box-shadow: 1px 1px 5px 0 rgba(0, 0, 0, 0.3);
 
      z-index: 999;
 
      width: max-content;
 
      max-width: 150px;
 
      overflow-wrap: break-word;
 
      text-align: center;
 
      transform: translateX(-50%) translateY(5px);
 
      transition: transform .3s ease;
 
 
     }
 
     }
 
+
    /* END OF CHEVRON CLASSES */
     .hover-text:hover .tooltip {
+
   
      transform: translateX(-50%) translateY(0);
+
   
 +
    /* HOVER ANIMATION CLASSES */
 +
    /* Tooltip fade-in */
 +
     .tt-target:hover .tt-container {
 +
        opacity: 1;
 +
        transform: translate(-50%, 0);
 +
        pointer-events: auto;
 +
        user-select: auto;
 +
        -webkit-user-select: auto;
 +
        -ms-user-select: auto;
 
     }
 
     }
  
     .tooltip-text-container {
+
    /* Text bold on hover */
      font-size: 90%;
+
     .tt-target:hover {
      margin-bottom: 1px;
+
        border-bottom: 0.0625em dashed;
 
     }
 
     }
}}</includeonly><noinclude>
+
    /* END OF HOVER ANIMATION CLASSES */
 +
   
 +
}}</includeonly><noinclude>{{Documentation}}
 
<pre>text text {{tt|Hover me|blablablablabla}} text text</pre>
 
<pre>text text {{tt|Hover me|blablablablabla}} text text</pre>
Results in: text text {{tt|Hover me|blablablablabla}} text text</noinclude>
+
Results in: text text {{tt|Hover me|blablablablabla}} text text
 +
[[Category:Templates]]
 +
</noinclude>

Latest revision as of 12:34, 26 August 2025

Documentation icon Template documentation[create]
text text {{tt|Hover me|blablablablabla}} text text

Results in: text text Hover me text text