CSS: How to align vertically a “label” and “input” inside a “div”?

后端 未结 7 1358
刺人心
刺人心 2020-11-29 17:59

Consider the following code:

HTML:

7条回答
  •  伪装坚强ぢ
    2020-11-29 18:31

    div {
        display: table-cell;
        vertical-align: middle;
        height: 50px;
        border: 1px solid red;
    }

    The advantages of this method is that you can change the height of the div, change the height of the text field and change the font size and everything will always stay in the middle.

    http://jsfiddle.net/53ALd/6/

提交回复
热议问题