防止d性项目左右渲染

防止d性项目左右渲染,第1张

防止d性项目左右渲染

添加此样式

.inner {  flex-direction: column;}

这告诉flexbox在行而不是列中显示其子级。(我知道,很奇怪,对吧?)

更新的代码段:

.container {  height: 200px;  width: 200px;  background: cornflowerblue;  position: relative;}.inner {  height: 100%;  position: absolute;  left: 0;  width: 100%;  top: 0;  display: -webkit-box;  display: -moz-box;  display: -ms-flexbox;  display: -webkit-flex;  display: flex;  align-items: center;  justify-content: center;  flex-direction: column;}.square {  width: 30px;  height: 30px;  background: tomato;  display: block;}<div >  <div >    <div ></div>    <p>some text</p>  </div></div>


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5621120.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-15
下一篇 2022-12-15

发表评论

登录后才能评论

评论列表(0条)

保存