DEV Community


Discussion on: Making A Switch In CSS

awolfika profile image
Máté Farkas

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:

jckuhl profile image
Jonathan Kuhl Author

I'll keep that in mind!