Align vertically input elements in div

后端 未结 2 487
时光说笑
时光说笑 2021-01-24 14:16

I\'ve made a search on SO to know how can I align vertically input elements in a div. This div is inside a form. Most of questions, form elements have a lot of

相关标签:
2条回答
  • 2021-01-24 14:29

    Change this rule:

    .fillform div input{
        display: block;
        border: 2px solid rgba(255, 0, 0, 1.0);
        box-sizing: border-box;
        vertical-align: middle;
    }
    

    https://jsfiddle.net/m9ev8etj/

    0 讨论(0)
  • 2021-01-24 14:46

    Add position: relative;top: 50%;margin: 1px; to your .fillform div input class and try this:

    .fillform{
         width: 100%;
         height: 33%;
         bottom: 0;
         background: rgba(225, 43, 50, 1.0);
    }
    
    .fillform div{
         float: left;
         width: 100%;
         height: 200px;
         box-sizing: border-box;
         border: 2px solid rgba(0,0, 255, 1.0);
    }
    
    .fillform div input{
         float: left;
         border: 2px solid rgba(255, 0, 0, 1.0);
         box-sizing: border-box;
         position: relative;
         top: 50%;
         margin: 1px;
    }
    
    0 讨论(0)
提交回复
热议问题