Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

replace checkbox with unicode character

Tags:

css

I am trying to replace the unchecked checkboxes with the following unicode character: ☐ or ◻

I tried doing this by making the checkboxes' content property the unicode character, but that doesn't seem to be working.

Here is the CSS style that I tried to do the above with:

.question input[type='checkbox']{
    background:none;
    content:◻;
    cursor:pointer;
}

How can I replace the checkbox or hide it and in its place have a unicode character?

Here is a JSFiddle where I am trying to do this: http://jsfiddle.net/mNsAv/

like image 641
IMUXIxD Avatar asked Aug 28 '26 04:08

IMUXIxD


1 Answers

Example with :before

http://jsfiddle.net/mNsAv/2/

.question input[type='checkbox'] + label:before {
    content:"◻";
}
.question input[type='checkbox']:checked + label:before {
    content:"✓";
}
.question input[type='checkbox'] {
    display:none;
}
like image 79
MarZab Avatar answered Aug 31 '26 17:08

MarZab



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!