Created
February 19, 2014 02:11
-
-
Save wrumsby/9084819 to your computer and use it in GitHub Desktop.
Use an attribute selector to hide when count is 0.
This file contains hidden or 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
/** | |
* Use an attribute selector to hide when count is 0. | |
*/ | |
body { | |
font-family: sans-serif; | |
} | |
.badge { | |
display: inline-block; | |
padding: 3px; | |
min-width: 14px; | |
border-radius: 10px; | |
box-shadow: 2px 2px 6px #444; | |
background-color: #f00; | |
color: #fff; | |
font-weight: bold; | |
font-size: 10px; | |
text-align: center; | |
} | |
.badge[data-count="0"] { | |
display: none; | |
} |
This file contains hidden or 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
<!-- content to be placed inside <body>…</body> --> | |
<span class="badge" data-count="0">0</span> | |
<span class="badge" data-count="1">1</span> |
This file contains hidden or 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
// alert('Hello world!'); |
This file contains hidden or 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
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment