首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在网页/浏览器中使用Antd居中登录表单?

问如何在网页/浏览器中使用Antd居中登录表单?
EN

Stack Overflow用户
提问于 2018-12-27 23:07:18
回答 2查看 11.1K关注 0票数 5

当前输出:

​

代码语言:javascript
复制
<Row type="flex" justify="center" align="center">
    <Col span={4} >
      <form onSubmit={handleSubmit(this.handleSubmit)} >
        <Field
          style={{ marginBottom: 12 }}
          prefix={<Icon type="user" style={{ color: 'rgba(0,0,0,.25)' }} />}
          name="name"
          type="text"
          component={AInput}
        />
        <Field
          style={{ marginBottom: 12 }}
          className="form-group"
          prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />}
          name="password"
          type="password"
          component={AInput}
          />

          <Button

            block
            type="primary"
            htmlType="submit"
            className="login-form-button"
          >
            Log in
          </Button>
      </form>
    </Col>
  </Row>

上面的登录表单需要以网页为中心,我尝试了使用antd样式元素,但失败了。它将使用css内联样式,但我不想以这种方式。

EN

回答 2

Stack Overflow用户

发布于 2019-11-21 04:17:36

确保您的行占满整个页面

代码语言:javascript
复制
<Row type="flex" justify="center" align="middle" style={{minHeight: '100vh'}}>

输出如下所示:

​

票数 20
EN

Stack Overflow用户

发布于 2019-01-28 19:32:48

这完全取决于你父母的身高。使用这些道具(type=“flex”justify=“中心”align=“中间”),您的表单位于行的中心,但没有高度(添加高度: 100%)`。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53947114

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档