關於flex:1屬性的說明


flex:1含義:該盒子填滿父盒子的剩余部分。

舉例說明:

布局部分:

1 <template>
2     <view class="content"> 
3         <view class="inpt">
4             <input type="text">
5             <text>驗證碼</text>
6         </view>
7     </view>
8 </template>

樣式部分:

 1     .inpt {
 2         width: 80%;
 3         height: 60upx;
 4         border-bottom: 2upx solid #999999;
 5         display: flex;
 6     }
 7     .inpt input {
 8         flex: 1; 
 9     }
10     .inpt text {
11         color: #fff;
12         width: 20%;
13         display: flex;
14         justify-content: center;
15         align-items: center;
16         background-color: #007AFF;
17         border-radius: 10upx;
18         margin-left: 2%;
19     }

顯示效果如下:

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM