Creating Spoiler Text Using HTML Blocks

You could hijack the “highlight” format (ctrl/cmd+alt+h on selected text) within the rich-text editor instead of using a HTML block. Then in your global or post code injection field:

<style>
mark {
  background-color: black;
  color: black;
  transition: color 0.2s, background-color 0.2s;
  cursor: pointer;
}

mark:hover {
  color: inherit;
  background-color: inherit;
}
</style>

There’s no JS needed for this type of hover.

3 Likes