Checkboxes in web pages – how to make them bigger?

前端 未结 7 1136
南笙
南笙 2021-01-30 01:57

The standard checkboxes rendered in most browsers are quite small and don’t increase in size even when a larger font is used. What is the best, browser-independent way to displ

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-30 02:47

    I'm writtinga phonegap app, and checkboxes vary in size, look, etc. So I made my own simple checkbox:

    First the HTML code:

    
    

    Then the CSS:

    [role=checkbox]{
        background-image: url(../img/checkbox_nc.png);
        height: 15px;
        width: 15px;
        display: inline-block;
        margin: 0 5px 0 5px;
        cursor: pointer;
    }
    
    .checked[role=checkbox]{
        background-image: url(../img/checkbox_c.png);
    }
    

    To toggle checkbox state, I used JQuery:

    CLICKEVENT='touchend';
    function createCheckboxes()
    {
        $('[role=checkbox]').bind(CLICKEVENT,function()
        {
            $(this).toggleClass('checked');
        });
    }
    

    But It can easily be done without it...

    Hope it can help!

提交回复
热议问题