首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么-内容在我的情况下行不通?

为什么-内容在我的情况下行不通?
EN

Stack Overflow用户
提问于 2016-10-13 10:42:43
回答 1查看 1.1K关注 0票数 1

找不到为什么.user-name-box & .user-location divs不想留在家长中心的原因.

代码语言:javascript
复制
.main-content{
        display: flex;
        flex-flow: row nowrap;
        justify-content: center;
        align-items: center;
        width: 600px;
        background: grey;
    }
        .user-info{
            display: inline-flex;
            flex-flow: column nowrap;
            justify-content: center;
            align-content: center;
            width: 300px;
            background: red;
        }
            .user-name-box{
                display: flex;
                width: 100px;
                height: 100px;
                background: blue;
                color: white;
            }
            .user-location{
                display: flex;
                width: 100px;
                height: 100px;
                background: yellow;
                color: black;
            }
代码语言:javascript
复制
    <div class="main-content">

        <div class="user-info">

            <div class="user-name-box">user-name-box</div>
            <div class="user-location">user-location</div>

        </div>

    </div>

提前感谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-10-13 10:51:35

这是因为您在.user-info上使用的是align-items而不是align-items

代码语言:javascript
复制
.main-content {
  display: flex;
  flex-flow: row nowrap;
  justify-content: center;
  align-items: center;
  width: 600px;
  background: grey;
}
.user-info {
  display: inline-flex;
  flex-flow: column nowrap;
  justify-content: center;
  align-items: center;
  width: 300px;
  background: red;
}
.user-name-box {
  display: flex;
  width: 100px;
  height: 100px;
  background: blue;
  color: white;
}
.user-location {
  display: flex;
  width: 100px;
  height: 100px;
  background: yellow;
  color: black;
}
代码语言:javascript
复制
<div class="main-content">

  <div class="user-info">

    <div class="user-name-box">user-name-box</div>
    <div class="user-location">user-location</div>

  </div>

</div>

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40018775

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档