盒子使用flex垂直居中

时间:2020-05-01
<div class="row box">
        <form class="search">
            <input type="text">
            <button type="submit">搜一下</button>
        </form>
</div>

样式

.box{
    display: flex;
    justify-content: center;
    align-items: center;
}

.search{
    display: inline-flex;
    margin: 10px auto;
}