DEV Community

Cover image for Realistic Red Switch (Pure CSS)
Yoav Kadosh
Yoav Kadosh

Posted on • Edited on

Realistic Red Switch (Pure CSS)

This is my attempt at making a realistic switch using CSS only. I'm using multiple CSS techniques here, including gradients, 3D transformations, animations, and transitions.

Making realistic 3D elements in CSS is kind of like making a very low-poly version of a high-poly model. In this example, I made the button out of 3 "polygons" (3 divs) that are all at 90 degrees from each other (creating like a square U shape).

Interested in a tutorial on how I made this? Let me know!

This pen is based on this beautiful Dribbble shot by Voicu Apostol https://dribbble.com/shots/14172039-3D-Red-Switch

Latest comments (16)

Collapse
 
ykadosh profile image
Yoav Kadosh

Hi everyone, I just published a detailed tutorial on how I made this! Check it out: dev.to/ykadosh/how-i-made-this-rea...

Collapse
 
eunit99 profile image
Emmanuel Uchenna

With just <input type="checkbox" checked> this is really impressive.

Collapse
 
katieadamsdev profile image
Katie Adams

This is just ridiculously, jaw-droppingly amazing 😮

Collapse
 
omril321 profile image
Omri Lavi • Edited

Wow that's really amazing! Great job! If you'll ever write a post about the process of building it I'd be very interested in reading it :D

Collapse
 
maxart2501 profile image
Massimo Artizzu

Very cool!
Now do that using only a <input type="checkbox"> element :trollface:

Collapse
 
bgrand_ch profile image
Benjamin Grand

Amazing, congratulation!

Collapse
 
littlegrapeguy profile image
Gautaman

Very Impressive!

Collapse
 
lucasandre profile image
Lucas André

Awesome!!

Collapse
 
skylersaville profile image
Skyler Saville

It’s so beautiful. I can’t stop clicking on it.

Collapse
 
ra1nbow1 profile image
Matvey Romanov

Impressive work