html - CSS : Align items in flex layout

标签 html reactjs css flexbox

我希望向下箭头位于页面的底部中央。我试图通过 flex 布局来实现这一点。但到目前为止无法做到。有人可以帮帮我吗 ?下面是我的 css/html

.flex-description-container {
  display: flex;
  flex-flow: row wrap;
  align-items: center
}

.flex-item-descriptionText {
  padding: 10px;
  color: white;
  font-weight: bold;
  font-size: 4em;
  text-align: center;
  flex: 1;
}

.flex-item-descriptionImage {
  padding: 10px;
  color: white;
  flex: 1;
}

.flex-item-next {
  flex: 1 100%;
  align-items: center;
  align-self: flex-end;
  justify-content: center;
}

应用程序.jsx>

<Parallax.Layer
                    offset={0} speed={0}
                    onClick={() => this.parallax.scrollTo(1)}>
                    <div class="flex-description-container ">
                        <div class="flex-item-descriptionText">Text </div>
                        <div class="flex-item-descriptionImage">
                            <img src={url('desk')} style={{ width: '50%' }} />
                        </div>
                        <div class="flex-item-next">
                            <img src={url('down')} style={{ width: '5%' }} />
                        </div>
                    </div>
                </Parallax.Layer>

enter image description here

PS:我正在使用这个 react component

最佳答案

只需将 display:flex 添加到 .flex-item-next 即可。

.flex-item-next {
  flex: 1 100%;
  display: flex;
  align-items: center;
  align-self: flex-end;
  justify-content: center;
}

参见 working implementation .

关于html - CSS : Align items in flex layout,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54167236/

相关文章:

reactjs - 从react js中的onClick事件获取对象数据和目标元素

javascript - 使用 React 类在 Three.js 中进行文件分离

javascript - 如何将其转换为 html 可读代码?

google-chrome - CSS3多重背景?

javascript - 显示/隐藏表单区域(使用 Bootstrap )

javascript - React.JS 将一个 HTML 文件插入另一个 HTML 文件。

javascript - 将 SVG 作为 React 组件导入不适用于 Next.js

html - 在不更改格式的情况下将 CSS3 下拉菜单添加到现有菜单项

html - 将包装器 div 重叠到前一个 div 中的 Div 元素

jquery - 相对于带有滑动侧边栏的父 Div 的固定位置