61,115
社区成员
发帖
与我相关
我的任务
分享
<div class="div" >
<text class="label">左侧文字</text>
<text class="label">右侧文字</text>
</div>
.div{
display: flex; /* 弹性布局 */
margin-top: 10px;
justify-content: space-between; /* 横向中间自动空间 */
}
.div{
flex-direction: row;
align-items: center;
height: 60px;
padding-left: 30px;
padding-right: 30px;
justify-content: space-between;
}
解决了。这样设置就好了。
<div class="div" >
<text class="left">左侧文字</text>
<text class="middle"></text>
<text class="right">右侧文字</text>
</div>
.div {
width: 100%;
display: flex;
}
.div .middle{
flex: 10;
}
.div .left, .div .right {
flex: 2;
}
.div .right {
text-align: right;
}
<div class="div" >
<text class="label">左侧文字</text>
<text></text>
<text class="label">右侧文字</text>
</div>
.div {
width: 100%;
display: table;
}
.div text{
display: table-cell;
}
.div .label {
width: 100px;
}
不然就写左浮动右浮动