【问题标题】:using flexbox and scaling images and stay on the same line使用 flexbox 和缩放图像并保持在同一行
【发布时间】:2016-08-17 22:46:03
【问题描述】:

我有以下 jsfiddle。

请注意,当图像缩放时,它们不会保持在同一条线上。如何使用 flexbox 缩放图像,使它们在浏览器调整大小时保持在同一行。

见下面的代码: http://codepen.io/jasmine1233333/pen/NNBVZe

CSS:

.npwfu-example-shell {
    overflow: hidden;
    min-width: 1100px;
    max-width: 1920px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    backface-visibility: hidden;
}

.npwfu-example-shell .example-grid {
    box-sizing: border-box;
    width: 100%;
    margin-left: 80px;
    transition: transform 0.5s;
    transition-timing-function: cubic-bezier(0, 0, 0.26, 0.89);
    will-change: transform;
    text-align: left;
    min-height: 360px;
    display: flex;
    align-items: flex-end;
    flex-flow: nowrap;
    backface-visibility: hidden;
}

.create-option {
    flex: 0 0 auto;
    max-width: 20%;
    margin-top: 10px;
    margin-bottom: 10px;
    margin-right: 0.5%;
    cursor: pointer;
    display: inline-block;
    vertical-align: bottom;
    backface-visibility: hidden;
}

.create-option-thumb {
    width: 100%;
    height: 100%;
    overflow: hidden;
    box-shadow: 0px 1px 3.36px 0.14px rgba(0, 0, 0, 0.14);
    transition: transform 0.5s ease-in;
    backface-visibility: hidden;
}

.create-option-thumb-img img {
    width: 100%;
    height: auto;
    z-index: -1;
}

.create-option-label {
    padding: 0px;
    color: #82919b;
    font-size: 1.38em;
    font-weight: 400;
    width: 100%;
    text-align: center;
    display: block;
    margin-top: 1.1em;
}

【问题讨论】:

  • 图像不会溢出到我的另一行。 (您是这个意思吗?) 您是否仔细检查了您的代码笔?也许发布的代码之外的东西正在影响它。

标签: javascript jquery html css flexbox


【解决方案1】:

我不确定您要做什么,但您可以尝试添加:

article{
  align-self:center;
}

【讨论】:

    猜你喜欢
    • 2015-07-31
    • 2010-11-25
    • 2012-07-26
    • 2019-03-04
    • 2015-10-05
    • 2020-09-21
    • 2015-08-08
    • 1970-01-01
    相关资源
    最近更新 更多