Update: This issue is isolated to one specific page. Other pages within the website are displaying correctly.
Recently, I developed a web page using React and Material-UI. The main components utilized are Grid
and Container
. While the layout appears fine on desktop screens, there seems to be a problem on mobile devices. Here is a glimpse of how it appears on the mobile screen:
https://i.sstatic.net/061Pw.png
An unnecessary space (light grey) is created, causing the pictures and cards to extend beyond the screen's maximum width. However, the header (blue) and background (light blue) retain the appropriate width (the width of the screen).
I am utilizing Grid
and Container
in my layout.
Below is the root component containing the cards:
<Grid
container
spacing={0}
direction="row"
justify="space-around"
alignItems="center"
style={{ minHeight: "20vh" }}
> ....
Additionally, there is another container that exceeds the width:
<Container maxWidth="lg" style={{ marginBottom: "5vh" }}>
<Paper style={{ padding: 20 }}>
<Grid
container
spacing={0}
direction="column"
justify="flex-start"
alignItems="center"
> ....
The header, displayed correctly, is a simple AppBar
.
The overflowing image at the top is defined as follows:
<div className={classes.heroContent}>
<Container maxWidth="md" align="center">
<Grid
container
direction="column"
justify="flex-end"
alignItems="center"
> ...
Additionally, the classes.heroContent
includes:
heroContent: {
backgroundImage: `url(${grupo})`,
backgroundSize: "cover",
backgroundRepeat: "no-repeat",
backgroundPosition: "center",
padding: theme.spacing(8, 0, 8),
minHeight: "20vh",
}, ...
What could possibly be causing this overflow issue? Despite reviewing the documentation, I am struggling to pinpoint the bug.