将2个段落垂直居中于1 div之间

时间:2018-03-19 18:05:33

标签: html css

我有两个p和一个div。

我希望文本垂直居中。

<div class="toggle-area">
    <p>SEARCH BY</p>
    <div class="switch-inner">
        <p class ="toggle-inline">Business group</p>
        <div class="toggle-btn toggle-inline">
            <label class="switch">
              <input type="checkbox">
              <span class="slider round"></span>
            </label>
        </div>
        <p class="toggle-inline">Borrower</p>
    </div>
</div>

这里是CSS:

.toggle-btn {
    margin: auto;
    text-align: center;
}
.toggle-area {
    padding-top:31px;
    padding-bottom: 30px;
    text-align: center;

}
.toggle-inline {
    display: inline;
    line-height: 100%;

}
.search-input {
    text-align: center;
    width: 400px;
    margin: auto
}
.switch-inner {
    vertical-align: middle;
}

div包含一个开关切换输入。详细的css是here

这是实际行为

And here's the actual behavior

这就是我的意思

And here's what I would

0 个答案:

没有答案
相关问题