我花了好几个小时试图找出为什么两个div只会在使用弹性框保持在同一行时,在标题类的段落中的html中添加换行符或者设置宽度以便必须定义我想要的是对于肖像div,设置宽度为300px,bio为尺寸以填充剩余尺寸。
CSS
.intro {
display: flex;
flex-flow: row wrap;
align-items: center;
justify-content: space-between; }
.bio {
order: 1;
flex-grow: 1; }
.bio p {
width: 50%;
margin: 0;
padding: 0; }
.portrait {
order: 2;
width: 300px; }
.portrait img {
width: 100%;
border: 30px solid white; }
HTML
<div class="intro">
<div class="portrait">
<img src="assets/img/me.jpg" alt="Nicola Sansom">
</div>
<div class="bio">
<h1>Header</h1>
<p>Content</p>
<div class="well-versed">
<b>1 Col</b>
</div>
</div>
</div>
答案 0 :(得分:0)
.intro {
display: flex;
/*flex-flow: row wrap;*/
align-items: center;
/* justify-content: space-between;*/ }
.bio {
width:100%;
background-color:pink;
order: 1;
/*flex-grow: 1; */}
.bio p {
width: 50%;
margin: 0;
padding: 0; }
.portrait {
order: 2;
width: 300px; }
.portrait img {
width: 100%;
border: 30px solid white; }
&#13;
<div class="intro">
<div class="portrait">
<img src="assets/img/me.jpg" alt="Nicola Sansom">
</div>
<div class="bio">
<h1>Header</h1>
<p>Content</p>
<div class="well-versed">
<b>1 Col</b>
</div>
</div>
</div>
&#13;