How to align the second div to right when the two divs are displayed in flex?

痴心易碎 提交于 2020-01-06 05:49:06

问题


I want the second div to align at the right to place it in where it should be but is it possible if they're displayed in flex? Help me guys this one gives me headache.

login.html

    <div style="display: flex;">
      <div (click)="openPasswordRecovery()" style="color:gray">
        Remember Me
      </div>
      <div style="text-align: right; color:gray">
        Forgot Password?
      </div>              
    </div>


回答1:


Use space-between, the last item always goes to the end:

<div style="display: flex; justify-content: 'space-between'">

Learn more about justify-content here



来源:https://stackoverflow.com/questions/58461318/how-to-align-the-second-div-to-right-when-the-two-divs-are-displayed-in-flex

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!