/* ---------------------------------- * CHECKBOXES / RADIOS * ---------------------------------- */ label.pack-checkbox, label.pack-switch { display: inline-block; vertical-align: middle; width: 5rem; height: 5rem; position: relative; background: none; } label.pack-checkbox input, label.pack-switch input { margin: 0; opacity: 0; position: absolute; top: 0; /* the conflict between left/right/width is resolved differently in LTR and * RTL. The goal here is to keep "input" invisible */ left: 0; right: 0; width: 0; } label.pack-checkbox input ~ span:after { content: ''; position: absolute; /* CSS will resolve the conflict among left, right, and width "intelligently" and pick left+width for LTR and right+width for RTL. */ left: 50%; right: 50%; top: 50%; margin: 0; margin-top: -1.1rem; margin-inline-start: -1.1rem; width: 2.2rem; height: 2.2rem; pointer-events: none; } label.pack-checkbox input ~ span:after { background: image-set(url("switches/images/check/default.png") 1x, url("switches/images/check/default@1.5x.png") 1.5x, url("switches/images/check/default@2x.png") 2x, url("switches/images/check/default@2.25x.png") 2.25x) no-repeat center top / 2.2rem auto; } /* checkbox & radio: disabled state */ label.pack-checkbox input:disabled ~ span:after { opacity: 0.4; } label.pack-checkbox input:checked ~ span:after, label.pack-switch input:checked ~ span:after { background-position: center bottom; } /* 'Dangerous' switches */ label.pack-checkbox.danger input ~ span:after { background-image: image-set(url("switches/images/check/danger.png") 1x, url("switches/images/check/danger@1.5x.png") 1.5x, url("switches/images/check/danger@2x.png") 2x, url("switches/images/check/danger@2.25x.png") 2.25x); } /* ---------------------------------- * ON/OFF SWITCHES * ---------------------------------- */ label.pack-switch input ~ span:after { content: ''; position: absolute; offset-inline-end: 0; top: 50%; width: 6rem; margin: -1.4rem 0 0; height: 2.7rem; pointer-events: none; border-radius: 1.35rem; overflow: hidden; background-color: #e6e6e6; background-image: image-set(url("switches/images/switch/background_off.png") 1x, url("switches/images/switch/background_off@1.5x.png") 1.5x, url("switches/images/switch/background_off@2.25x.png") 2.25x); background-repeat: no-repeat; background-size: 9.2rem 2.7rem; transition: background 0.2s ease; } html[dir="ltr"] label.pack-switch input ~ span:after { background-position: -3.2rem 0; } html[dir="rtl"] label.pack-switch input ~ span:after { background-position: 0; } /* switch: 'ON' state */ label.pack-switch input:checked ~ span:after { background-color: #e6e6e6; background-repeat: no-repeat; background-size: 9.2rem 2.7rem; } html[dir="ltr"] label.pack-switch input:checked ~ span:after { background-image: image-set(url("switches/images/switch/background.png") 1x, url("switches/images/switch/background@1.5x.png") 1.5x, url("switches/images/switch/background@2.25x.png") 2.25x); background-position: 0 0; } html[dir="rtl"] label.pack-switch input:checked ~ span:after { background-image: image-set(url("switches/images/switch/background_rtl.png") 1x, url("switches/images/switch/background_rtl@1.5x.png") 1.5x, url("switches/images/switch/background_rtl@2.25x.png") 2.25x); background-position: -3.2rem 0; } /* switch: disabled state */ label.pack-switch input:disabled ~ span:after { opacity: 0.4; } label.pack-switch input.uninit ~ span:after { transition: none; }