css - 连接输入字段和按钮引导模式

标签 css user-interface web bootstrap-modal frontend

我正在尝试连接我的输入字段和按钮,同时保持该字段在我的模式上居中。 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');
});

最佳答案

Flex 来拯救:

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

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

justify-content - 内部元素水平居中

align-items - 内部元素垂直居中

关于css - 连接输入字段和按钮引导模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49057533/

相关文章:

css - CSS 引用的 Flex 3 SWC Assets

css - 如何将一幅图像置于另一幅图像的中心并使其响应移动景观?

java - IPageLayout下添加keyevent切换ViewPart

Android:使用 Webview 从 Assets 中加载大图像

html - IE 中的样式问题 - 巨大的空间显示

html - 如何不显示两个相邻 div 之间的公共(public)边框?

python - 在运行时python中修改图像

python - 退出 tkinter gui,没有错误

json - 用户权限更改后 JWT 刷新

javascript - AngularJS - 如何绑定(bind)到指令内的 ngRepeat 元素