Radio/checkbox alignment in HTML/CSS

前端 未结 13 974
不知归路
不知归路 2020-12-04 08:08

What is the cleanest way to align properly radio buttons / checkboxes with text? The only reliable solution which I have been using so far is table based:

&l         


        
13条回答
  •  臣服心动
    2020-12-04 08:54

    I wouldn't use tables for this at all. CSS can easily do this.

    I would do something like this:

       

    p { margin: 0px 0px 10px 0px; } input { float: left; width: 50px; } label { margin: 0px 0px 0px 10px; float: left; }

    Note: I have used the clearfix class from : http://www.positioniseverything.net/easyclearing.html

    .clearfix:after {
        content: ".";
        display: block;
        height: 0;
        clear: both;
        visibility: hidden;
    }
    
    .clearfix {display: inline-block;}
    
    /* Hides from IE-mac \*/
    * html .clearfix {height: 1%;}
    .clearfix {display: block;}
    /* End hide from IE-mac */
    

提交回复
热议问题