Last active
June 7, 2016 23:28
-
-
Save davelowensohn/137fafddc3f5e0865ae0da71ea5f69c9 to your computer and use it in GitHub Desktop.
Styled Ember checkboxes
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
isSomething: Ember.computed.alias('model.something'), // boolean | |
actions: { | |
checkSomething() { | |
this.toggleProperty('model.something'); | |
}, | |
} |
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
input[type="checkbox"] { | |
display: none; | |
} | |
input[type="checkbox"] + label { | |
cursor: pointer; | |
position: relative; // so absolute positioning of :before & :after elements works | |
padding-right: 10px; | |
span { | |
padding-left: 20px; // to get out from under :before & :after | |
} | |
} | |
input[type="checkbox"] + label:before { | |
position: absolute; | |
content: '\00a0'; // ASCII empty checkbox | |
display: inline-block; | |
width: 13px; | |
height: 12px; | |
font-size: 13px; | |
font-family: 'Arial Unicode MS'; // for access to extended characters | |
background-color: #ccc; | |
border: 1px solid #333; | |
border-radius: 2px; | |
text-align: center; | |
cursor: pointer; | |
top: 1px; | |
} | |
input[type="checkbox"]:checked + label:after { | |
position: absolute; | |
content: '\2715'; // nice mathy 'x' | |
color: #333; | |
left: 2px; | |
font-size: 13px; | |
top: 1px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment