英文:
Nested flexboxes are not going in the direction i want
问题
我想要选择div class="SexSupport content"
内部的项目,这些项目已设置为display: flex;
和flex-direction: row;
,以便div class="SexSupport text"
和div class="SexSupportPic"
横向并排放置。
以下是我的 HTML:
<section id="SexSupport">
<div class="SexSupport content">
<div class="SexSupport text">
<div>
<h1 class="projectTitle">
SexSupport
</h1>
<h4 class="projectType">
app design, IxD, UX research
</h4>
</div>
<h4 class="projectCaption">
SexSupport 是解决美国社会中性健康教育不足的解决方案。它是一个保密的性健康平台,赋予用户查询性健康信息的权利。
该网站尊重用户的匿名性,同时不影响互动性。
</h4>
</div>
<div class="SexSupportPic">
<img src="Page 1/images/SexSupportphone.png" alt="显示 SexSupport 应用程序屏幕的 iPhone 图片">
</div>
</div>
</section>
以及我的 CSS:
#SexSupport {
background-color: #223843;
margin: 0%;
}
.SexSupport .content {
display: flex;
flex-direction: row;
align-items: center;
}
.SexSupportPic {
max-height: 80vh;
width: auto;
}
但是不知何故,它们拒绝并排放置,保持垂直方向:
我已经多次检查过,确保没有拼写错误,甚至多次询问 ChatGPT,以查看是否只是一个简单的修复,但图片仍然不移动,仍然直接位于文本下方。
请帮忙。
谢谢。
英文:
I want the items within div class="SexSupport content"
that are have set to display: flex;
and flex-direction: row;
so that div class="SexSupport text"
and div class="SexSupportPic"
are sitting horizontally next to each other.
a photo of my figma file that shows how i want my content formatted
here is my html:
<section id="SexSupport">
<div class="SexSupport content">
<div class="SexSupport text">
<div>
<h1 class="projectTitle">
SexSupport
</h1>
<h4 class="projectType">
app design, IxD, UX research
</h4>
</div>
<h4 class="projectCaption">
SexSupport is the solution to the lack of sexual
health education in American society. It is a
confidential sexual health platform that empowers
users to inquire about their sexual health.
The site honors users anonymity without undermining
interactivity.
</h4>
</div>
<div class="SexSupportPic">
<img src="Page 1/images/SexSupportphone.png" alt="picture of iPhones displaying screens from the SexSupport app">
</div>
</div>
</section>
and my CSS:
#SexSupport {
background-color: #223843;
margin: 0%;
}
.SexSupport .content {
display: flex;
flex-direction: row;
align-items: center;
}
.SexSupportPic {
max-height: 80vh;
width: auto;
}
but for some reason, they refuse to sit next to each other and remain in a vertical orientation:
a photo of my code preview that shows how it is displayed instead
I've tried rereading it over and over to make sure there are no typos and i even asked chatGPT multiple times to try to see if it was just a simple fix but the picture refuses to budge and remains directly below the text.
pls assist.
thank you.
答案1
得分: 0
我尝试了您的代码,并且它通过移除.SexSupport
和.content
之间的空格工作,就像这段代码一样:
.SexSupport.content {
display: flex;
flex-direction: row;
align-items: center;
}
英文:
I tried your code, and it works by removing the space between .SexSupport
and .content
just like this code:
.SexSupport.content {
display: flex;
flex-direction: row;
align-items: center;
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论