FANDOM


  • I am trying to create a template to hide text as spoilers. The way I envisioned the template was to set the background the same color as the text, and have the user highlight the block to reveal the text;

    SpoilerHighlight

    This will work if Text is not a hyperlink which will change the color and reveal the text. Even if I change the bg and text color to red, there's also the case of an invalid link which will use a different shade of red. Is there a way around this?

      Loading editor
    • You can also use w:c:dev:SpoilerAlert ,

        Loading editor
    • You can also make your template contents use something like
      <div class="spoilers">{{{1}}}</div>
      and then insert
      .spoilers, .spoilers a, .spoilers a.new /* etc. */ {
          color: transparent;
      }
      into the wiki's CSS.
        Loading editor
    • Minato826
      Minato826 removed this reply because:
      Already answered
      19:01, January 1, 2018
      This reply has been removed
    • Or you could use collapsible elements.

        Loading editor
    • KockaAdmiralac wrote:
      You can also make your template contents use something like
      <div class="spoilers">{{{1}}}</div>
      and then insert
      .spoilers, .spoilers a, .spoilers a.new /* etc. */ {
          color: transparent;
      }
      into the wiki's CSS.

      I tried following your example, but it does not seem to work.

      <div id="spoiler-hide">Spoiler<sup>Highlight</sup><span class="spoiler-text">[[Test]]{{{Text|}}}</span></div>
      .spoiler-hide {
       
      color: transparent
       
      }
        Loading editor
    • If that's how your template looks like, your CSS should look like
      .spoiler-text, .spoiler-text a, .spoiler-text a.new {
          color: transparent;
      }
        Loading editor
    • A FANDOM user
        Loading editor
Give Kudos to this message
You've given this message Kudos!
See who gave Kudos to this message