css - 更改为移动布局时,material-ui 响应更改
问题描述
我一直在尝试学习如何使用 material-ui 做出反应,并尝试实现登录屏幕。这是我的沙盒链接:https ://codesandbox.io/s/cool-bird-tc95j?file=/src/App.js
我不知道什么时候有移动显示,那么卡片的宽度看起来不错,但是当它是网络形式时,它的宽度非常大。
我在这做错了什么?
import React, { PureComponent, Fragment, Component } from 'react'
import stylesheet from './register.sass'
import Grid from '@material-ui/core/Grid'
import TextField from '@material-ui/core/TextField/TextField'
import Paper from '@material-ui/core/Paper/Paper'
import Typography from '@material-ui/core/Typography'
import InputAdornment from '@material-ui/core/InputAdornment/InputAdornment'
class Login extends Component {
render() {
return (
<Fragment>
<style dangerouslySetInnerHTML={{ __html: stylesheet }} />
<div className="body">
<div className="container">
<Grid container className="d-flex justify-content-center">
<Paper elevation={3} className="logincontainer" >
<div className="signup_header mt-3">
<Typography component="h1" variant="h5">
Log In
</Typography>
</div>
<div className="register_form">
<form>
<div className="mt-2 text-center">
<TextField
label="Phone No"
id="phone_no"
className=""
name="phone"
InputProps={{
startAdornment: <InputAdornment position="start">+91 |</InputAdornment>,
}}
variant="outlined"
onChange={this.handleChange}
/>
</div>
<div className="mt-2">
<button className="btn btn-dark btn-lg btn-block">
Login
</button>
</div>
</form>
<Typography component="h3" variant="h5" align="center" style={{ color: "darkorange" }}>
OR
</Typography>
</div>
</Paper>
</Grid>
</div>
</div>
</Fragment>
)
}
}
export default Login;
和萨斯
.body
background-image : url("https://images.pexels.com/photos/355465/pexels-photo-355465.jpeg");
background-repeat: no-repeat;
background-repeat: no-repeat;
background-size: cover;
width: 100%;
height: 100vh;
.signup_card
margin-left: 25%;
.signup_header
display: flex;
align-items: center;
flex-direction: column;
.logincontainer
min-width: 80%;
margin-top: 15%;
.signup_image
margin-top: 25%;
.register_form
padding: 5%;
.input_style
width: 3rem !important;
height: 3rem;
font-size: 2rem;
.login_container
justify-content: center;
解决方案
推荐阅读
- ionic3 - Ionic - 从另一个页面或组件更新组件的变量
- fulcro - 如何让 devcards 与 shadow-cljs 一起使用
- reactjs - 旧的 react 和 IE11 polyfills
- xml - Cherrypy 似乎不适用于 curl 发布请求
- javascript - jQuery删除属性不起作用
- sql - 日期时间列的“Where”语句所需的格式
- .net - 如何从外部网站获取数据到 .NET Core 中的 Web API?
- python-3.x - 尝试从终端安装 pip 时出错
- javascript - Android - 仅顺时针旋转视图 180 度
- spring-boot - Spring Boot:在应用程序启动时通过 rest 调用检索配置