如何实现flexbox元素的内联流



我有一些inline-block元素也需要是flex,因为我希望他们的孩子以某种方式行事。有办法吗?请不要建议浮动。

编辑:这是一把小提琴老实说,我只是想表明一点。我知道它不起作用。当我的目标不是改变元素本身的行为时,为什么我必须篡改元素显示属性?这只是flex仍然糟糕的原因之一。

这就是您想要实现的吗?

.container{
    width: 500px;
    height: 500px;
    border: dashed 5px red;
    white-space: nowrap;
    display:flex;
    flex-wrap:wrap;
    
}
p{
    white-space: normal;
    flex: 1 1 100%;
}
.child{
    width: 190px;
    height: 100px;
    border: dashed 5px blue;
    flex:1 1 20%;
    display: flex; /* do not change this! */
    /* display: inline-block; */
}
<div class="container">
   <p> i want my children next to each other...i wish i could just make them inline-block</p>
    <div class="child"><p>some fancy flexbox stuff going on in here</p></div>
    <div class="child"><p>some fancy flexbox stuff going on in here</p></div>
    <div class="child"><p>some fancy flexbox stuff going on in here</p></div>
    <div class="child"><p>some fancy flexbox stuff going on in here</p></div>
</div>

最新更新