如果 div 容器 'display:flex' 不起作用,有什么解决方案吗?

问题描述 投票:0回答:1

这可能是我自己的错误或粗心,在遵循视频教程的目的是在YouTube上学习,在主页内容的部分中,我希望图片和文本的内容像教程一样内联,但我的就像这个

enter image description here

所以我决定了解

display: flex
我们在家长部门中放置了两个内容部门 我想要它是什么样子

enter image description here

HTML:

enter image description here

CSS: enter image description here

html css flexbox containers
1个回答
0
投票

如果你想使用flex dispaly,你必须将所有代码包装在flex中,并使用行方向 -> flex-direction: row; ,然后在右侧 div 放置您的图像,在左侧 div 设置 flex-direction: 列并编写其他代码,例如您的文本等..

© www.soinside.com 2019 - 2024. All rights reserved.