【问题标题】:Connecting input field and button boostrap modal连接输入字段和按钮引导模式
【发布时间】:2018-08-09 23:37:06
【问题描述】:

我正在尝试连接我的输入字段和按钮,同时保持该字段以我的模式为中心。 IE 不向左或向右浮动

Currently it looks like this.

I want it to look like this.

HTML---

                <div class="input-append">
                    <input id="input-zip" type="search" placeholder="Enter zip code"/>
                    <span class="input-btn">
                        <button type="button" class="btn btn-zip" data-dismiss="modal">CONTINUE</button>
                    </span>
                </div>

CSS----

.btn-zip {
    float: right;
    background: map-get($colors, bg-btn-card);
    color: map-get($colors, button-text);
    border-radius: 0;
    box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
    display: table;
    margin-bottom: 10px;
}

JQUERY--

$(window).load(function()
{
    $('#zip-modal').modal('show');
});

【问题讨论】:

    标签: css user-interface web bootstrap-modal frontend


    【解决方案1】:

    Flex 来拯救:

    .input-append{
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        }
    

    width: 100% - 扩展元素以水平适应整条线,从该宽度开始计算中心

    justify-content - 内部项目水平居中

    align-items - 内部项目垂直居中

    【讨论】:

    • 非常感谢!工作就像一个魅力:) 现在我只需要按钮和输入字段对齐
    猜你喜欢
    • 2013-03-16
    • 2016-08-10
    • 2013-12-23
    • 2013-03-06
    • 2017-04-09
    • 2021-10-22
    • 2014-07-04
    • 1970-01-01
    相关资源
    最近更新 更多