html - 向导响应问题

标签 html css twitter-bootstrap responsive-design media-queries

我正在创建以下向导。

Wizard

我试过跟随;但它不能正常工作。调整窗口大小时,其布局会受到干扰。它应该是响应式的。什么是实现它的最佳方法,以便无论分辨率如何,它都应该保持 Responsive

Fiddle with issue

HTML:

<div class="col-md-10">
    <div class="wizard-wrapper">
        <div class="node-wrapper text-center wactive">
            <div class="node"><span>1</span>

            </div>
            <label class="lbl-wizard">Singn Up</label>
        </div>
        <div class="node-wrapper text-center">
            <div class="node"><span>2</span>

            </div>
            <label class="lbl-wizard">Order Info</label>
        </div>
        <div class="node-wrapper text-center">
            <div class="node"><span>3</span>

            </div>
            <label class="lbl-wizard">Preview Info</label>
        </div>
        <div class="node-wrapper text-center">
            <div class="node"><span>4</span>

            </div>
            <label class="lbl-wizard">Payment Method</label>
        </div>
        <div class="node-wrapper text-center">
            <div class="node"><span>5</span>

            </div>
            <label class="lbl-wizard">Complete Order Info</label>
        </div>
        <div class="connection"></div>
    </div>
</div>

CSS

/* wizard */
.wizard h2 {
    margin-top: 5px;
}

.node {
    background: #2d2f32;
    border-radius: 30px;
    color: #fff;
    display: inline-block;
    height: 37px;
    text-align: center;
    width: 37px;
    border: 4px solid #C2C6C9;
}

.wactive .node {
    background: #AA0405;
}
.node > span {
    display: inline-block;
    font-size: 14px;
    padding-top: 4px;
    font-family: open_sansbold;
}

.lbl-wizard {
    display: block;
    font-family: open_sansregular;
    font-size: 14px;
    color: #2d2f32;
    padding-top: 5px;
}

.node-wrapper.text-center {
    float: left;
    padding: 0 5%;
    position: relative;
    z-index: 1;
}

.connection {
    background: #c2c6c9;
    display: inline-block;
    height: 5px;
    margin-top: -113px;
    padding-top: 7px;
    position: relative;
    vertical-align: middle;
    width: 100%;
    z-index: 0;
}

仅供引用:我正在使用 Bootstrap 。

最佳答案

您可以将 node.wrapper 元素的宽度设置为分辨率宽度的五分之一。

width: calc(100% / 5);

此外,您应该更改 .connection 使其保持在一个位置:

.connection {
    background: #c2c6c9;
    display: block; (new)
    height: 5px;
    margin-top: 38px; (new)
    padding-top: 7px;
    position: absolute; (new)
    vertical-align: middle;
    width: 100%;
    z-index: 0;
}

Fiddle

关于html - 向导响应问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27408356/

相关文章:

javascript - 根据父级元素宽度而不是窗口 DOM 宽度触发响应

javascript - 如何在滚动时根据屏幕上的内容(展开/折叠)制作自动调整大小的 div?

html - 在网页问题上自动播放音乐

javascript - 在外部单击时关闭导航栏,而不仅仅是关闭按钮

html - Bulma 输入宽度不一致

css - 如何有效地使用 bootstrap-sass?

html - CSS3 和 HTML 的事件颜色

html - 为什么我不能将 html 最小高度设置为 100%?

html - 向右浮动就是向左浮动?

css - Bootstrap 缩略图中的垂直居中约束图像