Burger mobile menu

CSS: Custom checkbox style with image

Published: 22 Feb, 2017

As everyone knows, it is impossible to style input checkbox in CSS. But there is very easy workaround for that, of course, without JavaScript. You must create input checkbox with id attribute and label with for attribute (for must point on input’s ID). You need two images for your new styled checkbox. One image is for unchecked and second for checked state. I created in Inkscape in few seconds 2 images like below, and I placed them on one image (CSS sprite):


Custom checkbox style with image

Then only you must do 2 easy css tricks. One is to place correctly above image as background (see on css rule for .checker) and to use “+” is css selector for input and label. Remember that input checkbox must be just before label!




Check me!

Do you know other methods to style checkbox in CSS? Share your ideas in comments below 🙂

Scroll top
Check more tips and apps for developers here. mydevil
Zdjęcie w lewo Zdjęcie w prawo