Here are some CSS only toggle buttons that were designed by Stas Melnikov. There are a few styles to choose from circular or square toggles and with different colours in on and off state.

If you are having trouble with the pen, try the archived copy on GitHub

Toggle Switch Snippet

See the Pen Pure CSS Switches with Custom Properties by Stas Melnikov (@melnik909) on CodePen.0