我试图将图片从左向右移动,并将我的H3元素从右向左移动。
我最近刚刚通过teamtreehouse.com学习了有关flexbox的知识,但单凭我自己做起来,我似乎陷入了困境!
我似乎写的关于flex的任何东西似乎都行不通,所以我想我做的主要是错误的!
#about {
margin-top: 50px;
margin-left: 30px;
display: flex;
flex-flow: row wrap;
justify-content: space-between;
}
<div id="about">
<section>
<img src="img/meprofile.jpg" alt="Photograph of" class="profile-photo">
<h2 class="aboutme">About</h2>
<p>Hi,.</p>
<p>If you'd like to follow me on Twitter, my username is <a href="http://twitter.com/leehoward05">@leehoward05</a>.</p>
</section>
</div>
您想要的flex父级在DOM树中太高了。flex父级必须比子级高一级。试试这个:
#about > section {
margin-top: 50px;
margin-left: 30px;
display: flex;
flex-flow: row wrap;
justify-content: space-between;
}
.aboutme {
order: 0;
}
.profile-photo {
order: 3;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句