How to make “spoiler” text in github wiki pages?

前端 未结 6 1214
盖世英雄少女心
盖世英雄少女心 2020-12-22 23:14

I\'m trying to make text which is either invisible until moused over, or, has a \"show\" / \"hide\" button, or some other thing, so that it is not visible

6条回答
  •  鱼传尺愫
    2020-12-23 00:15

    If editing the CSS is an option for you, you can simply use

    [](#spoiler "Spoiler Filled Text")
    

    and then use (pure) CSS to give the correct appearance.

    a[href="#spoiler"] {
      text-decoration: none !important;
      cursor: default;
      margin-bottom: 10px;
      padding: 10px;
      background-color: #FFF8DC;
      border-left: 2px solid #ffeb8e;
      display: inline-block;
    }
    a[href="#spoiler"]::after {
      content: attr(title);
      color: #FFF8DC;
      padding: 0 0.5em;
    }
    a[href="#spoiler"]:hover::after,
    a[href="#spoiler"]:active::after {
      cursor: auto;
      color: black;
      transition: color .5s ease-in-out;
    }

    (Vaguely inspired from this code)

提交回复
热议问题