Aligning grid based form elements and their labels

前端 未结 2 1592
萌比男神i
萌比男神i 2021-01-23 23:02

we have a requirement where form elements are laid out in 3 separate columns. The labels can have varying amounts of text and the form elements will be mainly input boxes and te

2条回答
  •  孤城傲影
    2021-01-23 23:46

    Here is the fiddle: http://jsfiddle.net/nJZ6Y/19/

    You have to add a span inside each label, then add these CSS rules.

    label {
        min-height: 3em;
    }
    
    label span {
        vertical-align: -3em;
        display: inline-block;
    }
    

提交回复
热议问题