Skip to content

Instantly share code, notes, and snippets.

@awayken
Created March 3, 2015 15:06
Show Gist options
  • Save awayken/923b1adbc4a4ac48b1ed to your computer and use it in GitHub Desktop.
Save awayken/923b1adbc4a4ac48b1ed to your computer and use it in GitHub Desktop.
Spoiler
<p>This is non-spoiler.</p>
<p class="spoiler">This is a spoiler.</p>
<p>This is also non-spoiler.</p>
<p class="spoiler" data-spoiler-warning="Spoilers, Sweetie!">This is a spoiler.</p>
/* Regular page styles */
body {
color: #333;
font-family: georgia, "times new roman", serif;
text-shadow: 1px 1px rgba(0, 0, 0, .2);
}
::selection {
background: #333;
color: #fff;
text-shadow: none;
}
/* Spoiler styles */
.spoiler {
background: currentColor;
padding: 0.25em 0.5em;
}
.spoiler::before {
color: rgba(255, 255, 255, .9);
content: "Spoiler!";
display: inline-block;
vertical-align: baseline;
margin-right: 0.25em;
}
.spoiler::selection {
background: rgba(255, 255, 255, .5);
color: rgba(255, 255, 255, .75);
text-shadow: none;
}
.spoiler[data-spoiler-warning]::before {
content: attr(data-spoiler-warning);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment