在flex中显示两个div时,如何将第二个div对齐到右边? [英] How to align the second div to right when the two divs are displayed in flex?

查看:459
本文介绍了在flex中显示两个div时,如何将第二个div对齐到右边?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望第二个div在右边对齐以将其放置在应有的位置,但是如果它们在flex中显示是否可以?帮我,这让我头疼.

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

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>

推荐答案

使用space-between,最后一项总是结尾:

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

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

在此处详细了解调整内容

这篇关于在flex中显示两个div时,如何将第二个div对齐到右边?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆