[css] 用css怎么實作兩端對齊?
文本的兩端對齊
<style>
.form .text {
display: inline-block;
width: 65px;
text-align-last: justify;
}
</style>
<div class="form">
<div>
<span class="text">用戶名</span>
<input type="text">
</div>
<div>
<span class="text">密碼</span>
<input type="text">
</div>
</div>
元素的兩端對齊
<style>
.wrap {
width: 100px;
height: 100px;
border: 1px solid;
display: flex;
justify-content: space-between;
}
.wrap > div {
width: 20px;
height: 20px;
}
.a {
background: red;
}
.b {
background: blue;
}
</style>
<div class="wrap">
<div class="a"></div>
<div class="b"></div>
</div>
個人簡介
我是歌謠,歡迎和大家一起交流前后端知識,放棄很容易,
但堅持一定很酷,歡迎大家一起討論
主目錄
與歌謠一起通關前端面試題
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/260021.html
標籤:其他
