DEV Community

Discussion on: Making A Switch In CSS

Collapse
 
mfarkas profile image
mfarkas

Nice job! Tip: instead of using the left and right properties for moving the knob, you could also use transform: translateX() which will give you better performance (especially if animating things), since it does not require the browser to repaint and re-layout anything, it only updates in the compositor phase.
Here's my version of your switch: codepen.io/awolfika/pen/yryeGb

Collapse
 
jckuhl profile image
Jonathan Kuhl

I'll keep that in mind!