Is such alignment achievable without ?
后端 未结 5 1103
攒了一身酷
攒了一身酷 2021-01-17 11:57

\"The

My goal is an alignment as shown in the attached image (the fields on the left may have a

5条回答
  •  孤城傲影
    2021-01-17 12:52

    Yes, such alignment is possible. Using CSS classes, you can markup your HTML in such a way to achieve the same look of a table without the headache of using a table (or making the markup look ugly).

    Using this CSS:

    .label {
        display: inline-block;
        width: 100px;
    }
    
    .inputBox {
        width: 200px;
    }
    

    and this HTML:

    E-mail:
    Password:

    you'll get the layout you want.


    To do this with IE7 support, change the CSS above to this:

    .label {
        display: block;
        width: 100px;
        float: left;
        clear: left;
    }
    

    Then, add this line below the lines already shown:

    Example using IE7-compatible settings: http://jsfiddle.net/bbXXp/

提交回复
热议问题