2017-05-06 132 views
-2

Plz see image如何将此Flex-Box物品移动到img的旁边?

如何将此Flex-Box项目移动到img的旁边?

https://i.stack.imgur.com/eSy3w.png

<div class="brif fb"> 
       <div class="sml-con"><img class="sml-thumb" src="images/chosen/edward.jpg" alt=""></div> 
       <h3>The WhiteBeard Pirates</h3> 
       <div class="trai"> <i class="fa fa-video-camera mr5"></i> <span>Trailer</span></div> 
       <p>Meet the most unusual baby, known only as "Baby", who wears a suit, speaks with the voice and wit of Alec Baldwin, as he teams up with is seven-year old brother to stop the dastardly plot of the CEO of Puppy Co.</p> 

CSS

`.brif { width:69%; flex-wrap: wrap; padding:17px; align-items: flex- 
start; /* prevent the childs from taking full height */ } 

.brif .sml-con { width: 140px; height: 210px; } 

.brif .sml-thumb { width:100%; height:100%; } 

.brif h3 { padding: 9px 15px; } 

.brif .trai { background: #0397D6; padding: 5px 9px; border-radius:10px; 
margin:5px 0; } 

.brif .trai i{ margin-right:1px; }` 
+1

发帖最低工作的代码片段,我们将能够提出一个妥善的解决办法 – LGSon

+0

我已经做到了,你能删除负面raiting?,感谢 –

+0

我没下来投票 – LGSon

回答

0

如果添加的包装中的文本<div class="wrapper">,添加display: flex;和删除flex-wrap: wrap;他们会留下并排侧

.brif { 
 
    width: 69%; 
 
    display: flex; 
 
    padding: 17px; 
 
    align-items: flex-start; 
 
    /* prevent the childs from taking full height */ 
 
} 
 

 
.brif .sml-con { 
 
    width: 140px; 
 
    height: 210px; 
 
} 
 

 
.brif .sml-thumb { 
 
    width: 100%; 
 
    height: 100%; 
 
} 
 

 
.brif h3 { 
 
    padding: 9px 15px; 
 
} 
 

 
.brif .trai { 
 
    background: #0397D6; 
 
    padding: 5px 9px; 
 
    border-radius: 10px; 
 
    margin: 5px 0; 
 
} 
 

 
.brif .trai i { 
 
    margin-right: 1px; 
 
}
<div class="brif fb"> 
 
    <div class="sml-con"> 
 
    <img class="sml-thumb" src="images/chosen/edward.jpg" alt=""> 
 
    </div> 
 
    <div class="wrapper"> 
 
    <h3>The WhiteBeard Pirates</h3> 
 
    <div class="trai"> 
 
     <i class="fa fa-video-camera mr5"></i> 
 
     <span>Trailer</span> 
 
    </div> 
 
    <p>Meet the most unusual baby, known only as "Baby", who wears a suit, speaks with the voice and wit of Alec Baldwin, as he teams up with is seven-year old brother to stop the dastardly plot of the CEO of Puppy Co.</p> 
 
    </div> 
 
</div>