나는 인 flexbox있는 페이지의 중간에 로그인했습니다 양식을 배치하려고 :왜 양식이 중간에 없습니까?
<div class="auth-container">
<form [formGroup]="signInForm">
<mat-form-field>
<input formControlName="username" matInput placeholder="Username">
</mat-form-field>
<mat-form-field>
<input formControlName="password" matInput placeholder="Password" type="Password">
</mat-form-field>
<mat-error *ngIf="true">
Email is <strong>required</strong>
</mat-error>
<button mat-raised-button color="primary">SIGN IN</button>
<p>Form value {{ signInForm.value | json }} </p>
<p> Form status {{ signInForm.status | json}} </p>
</form>
</div>
스타일 :
.auth-container {
display: flex;
flex-direction: column;
align-content: center;
justify-content: center;
height: 100%;
width: 100%;
form {
display: flex;
width: 50%;
flex-direction: column;
}
}
가 align-content: center;
이 작동하지 않습니다와 나는 이유를 알아낼 수 없습니다. 그러나 justify-content: center;
이 작동합니다.
당신은 100 % 높이지만 ** 어떻게 **의 100 %가 사업부입니다 포장? 부모 높이 (DOM 체인 위쪽)는 명시하거나 계산할 수 있어야합니다. 대신 '100vh'를 사용해보십시오. –