一行有两个view,怎么一个左对齐,一个右对齐?

小程序 文章 2022-03-17 12:00 1784 0 全屏看文

AI助手支持GPT4.0

一行有两个view,怎么一个左对齐,一个右对齐?There are two views in a row, how can one be left-aligned and the other right-aligned?

一行有两个view,怎么一个左对齐,一个右对齐?

想要达到的效果:

目前效果:

代码和样式如下:

如果把rightTitle的flex-direction设成row-reverse,右边部分靠右了,但是里面的字体会颠倒,请问有什么解决办法?


The desired effect: the current effect: the code and style are as follows: if the flex direction of righttitle is set to row reverse, the right part is on the right, but the font inside will be reversed. What is the solution?

回答:

八九:

box样式

displayflex;

  align-itemscenter;

  justify-contentspace-between;


老张:

1、在左view和右view之间加一个view,flex:1即可。

养乐多💍:
.propertyBox{   display: flex;  flex-wrap: nowrap;  align-items: center;}.leftTitle{  flex:1;}
养乐多💍:别设置宽度
.:
.propertyBox{  display: flex;  justify-content: space-between;  align-items: center;}
尐飞魚คิดถึง:

.propertyBox {justify-content: space-between;}

-EOF-

AI助手支持GPT4.0