Is it possible to set the size of a checkbox using CSS or HTML?
width
and size
work under IE6+ but not with Firefox, where the checkbox stays 16x16 even if I set a smaller size.
|
It's a little ugly (due to the scaling up), but it works on most newer browsers:
|
|||||||||||||||||||||
|
Working solution for all modern browsers.
|
|||||||||||||||||||||
|
An easy solution is use the property
|
|||||||||
|
Preview: http://jsfiddle.net/h4qka9td/
HTML Code
|
|||||
|
My understanding is that this isn't easy at all to do cross-browser. Instead of trying to manipulate the checkbox control, you could always build your own implementation using images, javascript, and hidden input fields. I'm assuming this is similar to what niceforms is (from Staicu lonut's answer above), but wouldn't be particularly difficult to implement. I believe jQuery has a plugin to allow for this custom behavior as well (will look for the link and post here if I can find it). |
|||
|
I was looking to make a checkbox that was just a little bit larger and looked at the source code for 37Signals Basecamp to find the following solution- You can change the font size to make the checkbox slightly larger:
Then, you can align the checkbox properly by doing:
|
|||
|
Found this useful hint today: you can make checkboxes larger in Safari — which is generally resistant to the usual approaches — with this attribute: |
|||||
|
The other answers showed a pixelated checkbox, while I wanted something beautiful.
The result looks like this:
Even though this version is more complicated I think it's worth giving it a try. HTML
SCSS
Jsfiddle: https://jsfiddle.net/asbd4hpr/ |
|||
|
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?