html form - make inputs appear on the same line

前端 未结 7 2133
臣服心动
臣服心动 2021-01-03 19:17

I am struggling to make two html form inputs (first and last name) appear on the same line side by side. I have tried using float, but that seems to make the rest of the inp

7条回答
  •  一生所求
    2021-01-03 20:09

    This test shows three blocks of two blocks together on the same line.

    .group {
        display:block;
        box-sizing:border-box;
    }
    .group>div {
        display:inline-block;
        padding-bottom:4px;
    }
    .group>div>span,.group>div>div {
        width:200px;
        height:40px;
        text-align: center;
        padding-top:20px;
        padding-bottom:0px;
        display:inline-block;
        border:1px solid black;
        background-color:blue;
        color:white;
    }
    
    input[type=text] {
        height:1em;
    }
    First Name
    Last Name
    Address

提交回复
热议问题