1. 程式人生 > >Vue+min-width實現最大兩欄佈局

Vue+min-width實現最大兩欄佈局

 1 <style>
 2     .fitting-Modal-details{
 3         overflow: hidden;
 4     }
 5     .detailsContent{
 6         float: left;
 7         min-width: 50%;
 8         line-height: 30px;
 9     }
10 </style>
11 
12 <template>
13     <div class="fitting-Modal-details">
14          <div class="detailsContent">
15
<span>規劃ID:</span> 16 <span>aaaaaaaaaaaaaaa</span> 17 </div> 18 <div class="detailsContent"> 19 <span>使用者ID:</span> 20 <span>bbbb</span> 21 </div> 22 <div class="detailsContent"> 23
<span>主體:</span> 24 <span>ccccccccc</span> 25 </div> 26 <div class="detailsContent"> 27 <span>使用者擬合目標:</span> 28 <span>ddddddddddddddddddddddddd</span> 29 </div> 30
<div class="detailsContent"> 31 <span>建立時間:</span> 32 <span>eeeeeeeeeeeee</span> 33 </div> 34 <div class="detailsContent"> 35 <span>產品型別:</span> 36 <span>fffffffffffffffffffffff</span> 37 </div> 38 <div class="detailsContent"> 39 <span>產品型別擬合目標:</span> 40 <span>g</span> 41 </div> 42 <div class="detailsContent"> 43 <span>機房:</span> 44 <span>h</span> 45 </div> 46 <div class="detailsContent"> 47 <span>機房擬合目標:</span> 48 <span>iiiiiiiiiiii</span> 49 </div> 50 <div class="detailsContent"> 51 <span>狀態:</span> 52 <span>jjjjjjjjj</span> 53 </div> 54 <div class="detailsContent"> 55 <span>備註:</span> 56 <span>kkkkkk</span> 57 </div> 58 </div> 59 </template>
效果:
     注:設定每個div最小寬度為50%,這樣當相鄰div內容長度不超過50%時為兩個佔一行,當div內容長度超過50%時,因為設定了最小寬度為50%,它會繼續向後撐,所以單獨佔一行。