@import 'vars'; // labelauty // ============================================================ $icon-size: 16px; $label-min-width: 160px; $label-text-gap: 7px; /* Prevent text and blocks selection */ input.labelauty + label ::selection { background-color: rgba(255, 255, 255, 0); } input.labelauty + label ::-moz-selection { background-color: rgba(255, 255, 255, 0); } /* Hide original checkboxes. They are ugly! */ input.labelauty { display: none !important; } /* * Let's style the input * Feel free to work with it as you wish! */ input.labelauty + label { display: table; font-size: $font-size-base; padding: 10px 12px; margin-bottom: 0; background-color: $bg-color-base; color: $text-color; cursor: pointer; line-height: 1; border-radius: $border-radius; transition: background-color 0.25s; -moz-transition: background-color 0.25s; -webkit-transition: background-color 0.25s; -o-transition: background-color 0.25s; // -moz-user-select: none; // -khtml-user-select: none; // -webkit-user-select: none; // -o-user-select: none; user-select: none; } /* Stylish text inside label */ input.labelauty + label > span.labelauty-unchecked, input.labelauty + label > span.labelauty-checked { display: inline-block; line-height: $icon-size; vertical-align: bottom; } /* Stylish icons inside label */ input.labelauty + label > span.labelauty-unchecked-image, input.labelauty + label > span.labelauty-checked-image { display: inline-block; width: $icon-size; height: $icon-size; vertical-align: bottom; // vertical-align: middle; background-repeat: no-repeat; background-position: left center; transition: background-image 0.5s linear; -moz-transition: background-image 0.5s linear; -webkit-transition: background-image 0.5s linear; -o-transition: background-image 0.5s linear; } /* When there's a label, add a little margin to the left */ input.labelauty + label > span.labelauty-unchecked-image + span.labelauty-unchecked, input.labelauty + label > span.labelauty-checked-image + span.labelauty-checked { margin-left: $label-text-gap; } /* When not Checked */ input.labelauty:not(:checked):not([disabled]) + label:hover { background-color: $gray-lighter; color: $gray-dark; } input.labelauty:not(:checked) + label > span.labelauty-checked-image { display: none; } input.labelauty:not(:checked) + label > span.labelauty-checked { display: none; } /* When Checked */ input.labelauty:checked + label { background-color: $color-primary-600; color: #ffffff; } input.labelauty:checked:not([disabled]) + label:hover { background-color: $color-primary-500; } input.labelauty:checked + label > span.labelauty-unchecked-image { display: none; } input.labelauty:checked + label > span.labelauty-unchecked { display: none; } input.labelauty:checked + label > span.labelauty-checked { display: inline-block; } input.labelauty.no-label:checked + label > span.labelauty-checked { display: block; } /* When Disabled */ input.labelauty[disabled] + label { opacity: 0.7; } /* Add a background to (un)checked images */ input.labelauty + label > span.labelauty-unchecked-image { background-image: url( "images/input-unchecked.png" ); } input.labelauty + label > span.labelauty-checked-image { background-image: url( "images/input-checked.png" ); } input.to-labelauty + label { min-width: $label-min-width; } input.to-labelauty-icon + label { display: inline-block; padding: 8px 8px; + span { margin-left: $label-text-gap; } }