skip to Main Content

I am trying to get the below "sign in" button to be on the right end of my sign in form but I cannot achieve for some reason.

How I want it to look:

Figma Design

What it currently looks like:

Code

What my frontend code looks like:

    <RuxContainer className="container">
      <div slot="header" className="header-container">
        <h3 className="first-header-item">LOGO</h3>
        <RuxClock timezone="Z"></RuxClock>
        <RuxMonitoringIcon status="normal"></RuxMonitoringIcon>
      </div>
      <div className="body-container">
        <form className="rux-form">
          <h2 className="body-sign-in">SIGN IN</h2>
          <h6>Measure your success in the Space Force!</h6>
          <div className="sign-in-inputs">
            <rux-input
              id="email"
              placeholder="[email protected]"
              label="Email"
              type="email"
              ruxblur="{handleValidation()}"
            ></rux-input>
            <rux-input id="pw" label="Password" type="password"></rux-input>
          </div>
          <div className="sign-in-helper-functions">
            <rux-checkbox class="checkbox">Remember me</rux-checkbox>
            <h2 className="forgot-password">Forgot Password?</h2>
          </div>
        </form>
        <rux-button className="sign-in-btn" type="submit">
          Sign in
        </rux-button>
      </div>
    </RuxContainer>

What my CSS looks like:

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.body-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.rux-form {
  width: 30%;
  max-width: 430px;
}

sign-in-btn {
  align-self: flex-end;
}

I am new to CSS so any help there would be greatly appreciated as well, thanks!

2

Answers


  1. That’s not really "frontend code", as it doesn’t work in the browser. If you tidy it up a bit, and add a . in front of sign-in-btn, it does work:

    .header-container {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    
    .body-container {
      display: flex;
      flex-direction: column;
      align-items: center;
    }
    
    .form {
      width: 30%;
      max-width: 430px;
    }
    
    .sign-in-btn {
      align-self: flex-end;
    }
    <RuxContainer class="container">
      <div slot="header" class="header-container">
        <h3 class="first-header-item">LOGO</h3>
        <RuxClock timezone="Z"></RuxClock>
        <RuxMonitoringIcon status="normal"></RuxMonitoringIcon>
      </div>
      <div class="body-container">
        <form class="form">
          <h2 class="body-sign-in">SIGN IN</h2>
          <h6>Measure your success in the Space Force!</h6>
          <div class="sign-in-inputs">
            <input
              id="email"
              placeholder="[email protected]"
              label="Email"
              type="email"
              ruxblur="{handleValidation()}"
            ></input>
            <input id="pw" label="Password" type="password"></input>
          </div>
          <div class="sign-in-helper-functions">
            <checkbox class="checkbox">Remember me</checkbox>
            <h2 class="forgot-password">Forgot Password?</h2>
          </div>
        </form>
        <button class="sign-in-btn" type="submit">
          Sign in
        </button>
      </div>
    </RuxContainer>
    Login or Signup to reply.
  2. .header-container {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    
    .body-container {
      display: flex;
      flex-direction: column;
      align-items: center;
    }
    
    .form {
      width: 30%;
      max-width: 430px;
    }
    
    .btn {
      display: flex;
      justify-content:end
    }
    <RuxContainer class="container">
      <div slot="header" class="header-container">
        <h3 class="first-header-item">LOGO</h3>
        <RuxClock timezone="Z"></RuxClock>
        <RuxMonitoringIcon status="normal"></RuxMonitoringIcon>
      </div>
      <div class="body-container">
        <form class="form">
          <h2 class="body-sign-in">SIGN IN</h2>
          <h6>Measure your success in the Space Force!</h6>
          <div class="sign-in-inputs">
            <input
              id="email"
              placeholder="[email protected]"
              label="Email"
              type="email"
              ruxblur="{handleValidation()}"
            ></input>
            <input id="pw" label="Password" type="password"></input>
          </div>
          <div class="sign-in-helper-functions">
            <checkbox class="checkbox">Remember me</checkbox>
            <h2 class="forgot-password">Forgot Password?</h2>
          </div>
           <div class="btn">
         <button class="sign-in-btn" type="submit">
          Sign in
        </button>
        </div>
         
        </form>
       
      </div>
    </RuxContainer>
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search