Created
November 13, 2013 03:11
-
-
Save carlos-sanchez/7443059 to your computer and use it in GitHub Desktop.
Replace text with CSS We could use The Checkbox Hack here to make the text swap entirely CSS. The replacement happens the exact same way, it just happens when an invisible checkbox right before the word is either :checked or not. This means the word needs to be in a label as well, which is able to toggle that checkbox’s state through the for att…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#example { | |
position: relative; | |
} | |
#example-checkbox { | |
display: none; | |
} | |
#example-checkbox:checked + #example:after { | |
content: "Hide"; | |
position: absolute; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
background: white; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input id="example-checkbox" type="checkbox"> | |
<label for="example" id="example">Show</label> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment