DEV Community

Discussion on: How I Made This Realistic Red Switch (Pure CSS)

Collapse
 
jh3y profile image
Jhey Tompkins

Looks great! One tiny thing I'd change ๐Ÿค

Move the input outside the label and make the clickable area of the label half the size of the switch. That way, you can't click the side that's pressed in. Then it'll be "realistic" ๐Ÿ˜‰

Collapse
 
ykadosh profile image
Yoav Kadosh

Yes, others have suggested this also, however, I think that this is problematic in terms of accessibility since the user expects the whole switch to be clickable.

Collapse
 
jh3y profile image
Jhey Tompkins

I think that would be the least of the concerns in making this accessible ๐Ÿ˜…

However, If you want to take it a step further though, divs aren't allowed as children of label ๐Ÿ‘
Switch them to span and use display to style them up.

Thread Thread
 
ykadosh profile image
Yoav Kadosh

Yes, I guess you're right... ๐Ÿ˜…
And that's a good point regarding the divs ๐Ÿ‘