我正在尝试将表单置于页面中心。仅当我在检查工具中将Html和body标签的高度更改为100%但在IDE中编写的相同CSS不会在检查工具中起作用时,这种情况才会发生。
html,body{
height: 100% !important;
}
<div class="row h-100 flex-column justify-content-center align-items-center">
<form [formGroup]="form">
<div class="form-group">
<label for="username">Login</label>
<input formControlName="username" id="username" type="text" class="form-control">
</div>
<button class="btn btn-primary" type="submit">Sign Up</button>
</form>
</div>