Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Margin top has no effect

For the code below

import {
  TextField,
  Stack,
  Button,
  Box,
  Grid,
  SvgIcon,
  Typography,
  Divider,
  Link
} from "@mui/material";
// import IconGoogle from "../client/images/google.svg";

export default function Home() {
  return (
    <Grid container justifyContent="center" padding={20}>
      <Grid item>
        <Stack spacing={2} width={320}>
          <Typography component="label" variant="h5" alignSelf="center">
            Sign In
          </Typography>

          <Button variant="outlined" fullwidth>
            {/* <IconGoogle /> */}
            &nbsp; Sign in to Google
          </Button>
          <Divider> OR </Divider>
          <TextField variant="outlined" label="Email" fullwidth />
          <Stack>
            <TextField variant="outlined" label="Password" fullwidth />
            <Typography
              component="label"
              variant="subtitle1"
              sx={{ color: "gray", fontSize: 12 }}
            >
              Minimum 6 Character
            </Typography>
          </Stack>
          <Button variant="contained">Sign In</Button>

          <Link component="button" underline="none" sx={{ mt: 100 }}>
            Forgot Password
          </Link>
        </Stack>
      </Grid>
    </Grid>
  );
}

Edit Usage (forked)

It gives the following screen

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

which I expect the red rectangle portion to be much larger, since I set sx={{ mt: 100 }}. Why it’s not larger and how to rectify it?

>Solution :

If you use padding instead of margin, it does move the button down.

<Link component="button" underline="none" sx={{ pt: 100}}>
        Forgot Password
</Link>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading