How to replace a checkbox with an image

Posted by admin on Thu, 04/20/2017 - 09:51

A short note how to replace your checkbox with an image.

<div class="mycheckbox">
    <input type="checkbox" name="useful" id="useful" />
    <label for="useful">It is useful?</label>
</div>
.mycheckbox input[type="checkbox"] {
  display: none;
}
.mycheckbox input[type="checkbox"]+label {
   background: url('images/checkbox-off.png') no-repeat;
  width:20px;
  height: 20px;
}
.mycheckbox input[type="checkbox"]:checked + label {
  background: url('images/checkbox-on.png');
  width: 20px;
  height: 20px;
}
Tags: 
×

Hey! Don't miss a new cool stuff!

Comments

Anonymous (not verified)

Its like you read my mind! You seem to know so much about this, like you wrote the book in it or something. I think that you could do with some pics to drive the message home a bit, but other than that, this is great blog... Webdesign

Anonymous (not verified)

I don’t have the time at the moment to fully read your site but I have bookmarked it and also add your RSS feeds. I will be back in a day or two. thanks for a great site. Zonnepanelen

Anonymous (not verified)

I must say that overall I am really impressed with this blog. It is easy to see that you are passionate about your writing. If only I had your writing ability I look forward to more updates and will be returning. Zonnepanelen installateur

Anonymous (not verified)

I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the leisure here! Keep up the excellent work. Zonnepanelen

Anonymous (not verified)

That's what makes you the best. You should keep publishing more articles and you will Such Become One of the best writers ever Warmtepompen

Anonymous (not verified)

A very nice and good post this. I really like it very much. Keep this quality of your work on articles going on and please do not let the quality of your articles fall to bad. Cheers! Warmtepomp

Anonymous (not verified)

Once I thought about things like: why such information is for free here? Because when you write a book then at least on selling a book you get a percentage. Thank you and good luck on informing people more about it Webdesign

Anonymous (not verified)

I'm going to read this. I'll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article Webdesign

Anonymous (not verified)

That's what makes you the best. You should keep publishing more articles and you will Such Become One of the best writers ever Webdesign

Anonymous (not verified)

That's what makes you the best. You should keep publishing more articles and you will Such Become One of the best writers ever Webdesigner

Add new comment