将表单置于页面中心

我正在尝试将表单置于页面中心。仅当我在检查工具中将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>

peng3817 回答:将表单置于页面中心

标记中包含引导程序
<head>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm">
</head>
本文链接:https://www.f2er.com/3086959.html

大家都在问