css flex:1 导致子元素 设置100% 无效

<div class="parent">

<div class="child1">

</div>

</div>

.parent{

display:flex;

flex-direction: row;
}

.child1{

width:100%; //这个无效

}

//修改如下 parent加上 position: relative; 子加上 position: absolute;

.parent{

display:flex;

flex-direction: row;
position: relative ;
}

.child1{

position: absolute;

width:100%; 

left:0;

top:0;

}





猜你喜欢

转载自blog.csdn.net/laozhong110/article/details/79218789