Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create spoiler text?

Tags:

html

css

Hello I was wondering how to make spoiler text on a website with html/css. What I was is, text that is black with black background, but when hovered over, makes the black text turn white, making it visible.

like this

<span style="color: black; background: black;">test</span>

<p>Then when hovered over</p>

<span style="color: white; background: black;">test</span>
like image 309
Alexwall Avatar asked Feb 19 '15 19:02

Alexwall


People also ask

How do you do spoiler text on discord Iphone?

On the mobile version of Discord, you can use your keyboard to mark spoilers. By adding two bars (||) at the beginning and the end of your spoiler, it will black out the bracketed text once you send the message. Your spoiler tag should look something like this before you send: ||Insert spoiler here||.


1 Answers

The <details> HTML tag was designed specifically for this purpose. Here is the example from the MDN docs. Unfortunately, IE and edge don't support this tag as of January 2019.

<details>
    <summary>Details</summary>
    Something small enough to escape casual notice.
</details>
like image 161
XMB5 Avatar answered Sep 23 '22 11:09

XMB5