Hide text, but have it show up if copied and pasted without javascript

后端 未结 2 814
南笙
南笙 2021-01-15 12:54

I\'m trying to do a design for a short story site.
One of the stories I\'ve been told would work better if someone copied and pasted text, extra lines would show up.

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-15 13:36

    This answer is just a demonstration of the solution discussed in the comments of DBS' answer. Selecting the text will not indicate to you that you've selected any more than "This is visible", but pasting it into Notepad will show everything. Seems perfect for small ARGs or internet-based puzzles.

    div {
      color: #000;
      background-color: #FFF;
    }
    
    .hidden1{
      /* Match the background colour */
      color: #FFF;
      font-size: 0;
    }
    
    .hidden2{
      /* Transparent text, should work on any background colour */
      color: rgba(0,0,0,0); 
      font-size: 0;
    }
    This is visible. This is not. Nor is this.

提交回复
热议问题