How can I make a checkbox bigger?

后端 未结 6 1474
野趣味
野趣味 2021-01-04 20:26

My web page uses checkboxes. They appear very small. I tried to make them bigger by using \"font-size: 1.5em\". This didn\'t seem to change them at all.

Is there a

相关标签:
6条回答
  • 2021-01-04 21:05

    You can not change the appearance of check boxes in most browsers. Check this: http://www.456bereastreet.com/lab/styling-form-controls-revisited/checkbox/

    Try to add an element and make it change the status of the checkbox. Check this for an example: http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/

    0 讨论(0)
  • 2021-01-04 21:08

    You can do this using images.

    CSS

    #mycheckbox
    { 
        display: none; 
    }
    
    #mycheckbox + label
    { 
        float: left; 
        width: 200px; 
        height: 200px; 
        background: url('/path/to/photo_of_big_unchecked_box.png'); 
    }
    
    #mycheckbox:checked + label
    { 
        background: url('/path/to/photo_of_big_checked_box.png'); 
    }
    

    HTML

    <input type="checkbox" name="mycheckbox" id="mycheckbox"><label for="mycheckbox"></label>
    

    That's one way you might accomplish the goal.

    EDIT

    Here is the working link for IE

    0 讨论(0)
  • 2021-01-04 21:09

    You can use the CSS zoom tag.

    h6 {
      zoom: 5;
    }
    <h6><input type="checkbox"></h6>

    0 讨论(0)
  • 2021-01-04 21:12

    AS you cant change the appearance of checkboxes cross browser compatible, I suggest, to use something like Ryan Fait describes in his blog. This technique allows you to use custom graphics for your checkboxes.


    0 讨论(0)
  • 2021-01-04 21:18

    Perhaps it seems a little too obvious, but it works:

    input[type='checkbox'] {
        width: 30px;
        height: 30px;        
    }
    

    It works as you might expect on IE and Chrome, and even though it doesn't look like it's bigger on Firefox you still get a larger hit box:

    enter image description here

    0 讨论(0)
  • 2021-01-04 21:28

    Sadly, CSS is kinda undefined with <input> making possibilities of modifying them limited. Various browsers do things differently. width and height practically work on checkboxes only in Internet Explorer.

    Various solutions appeared, for example emulating checkboxes using JS, so those can be styled.

    0 讨论(0)
提交回复
热议问题