When items are set to full width, material ui grid alignItems flex-start only affects the first row

I'm currently working with the material ui grid system, and I have a specific requirement. I need to create a grid container with a fixed height of 200px that accommodates full-width items. The challenge here is that I want the items to fill the container starting from the top, leaving any remaining space only at the bottom.
Desired Layout: https://example.com/desired-layout.png

Current Output: https://example.com/current-output.png

Here's my code snippet:

<Grid
    container
    xs={12}
    justifyContent="center"
    alignItems="flex-start"
    css={css`
    height: 200px;
    background-color: #aaa;
    `}
>
    <Grid xs={12}>first row</Grid>
    <Grid xs={12}>second row</Grid>
    <Grid xs={12}>third row</Grid>
</Grid>

If anyone could assist me in resolving this issue, it would be greatly appreciated!

Answer №1

By utilizing AlignContent in place of AlignItems, the issue was successfully resolved.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

.scss compiling with errors

Recently, I embarked on a new Vue(3) project. Within this project, I have set up some basic styling in the App.scss file and created a HomeView.vue with a corresponding HomeView.scss file (located in the /src/views/Home directory). The styling from both fi ...

What could be the reason for my Form styling failure?

Currently working on freecodecamp's portfolio creation exercise. It should be a straightforward task, but I'm facing a small issue that's puzzling me. I'm trying to remove the border and outline (when focused) from my contact-area form ...

Is it possible to apply the DRY Concept to this React JS code?

https://i.stack.imgur.com/jcEoA.png import React from "react"; import { Chip, Box } from '@mui/material'; const Browse = () => { const [chip, setChip] = React.useState("all" ...

What is the best way to remove a specific HTML section using a JavaScript function?

I am struggling to figure out how to remove a specific HTML section using a button that is contained within the section itself. The section I want to delete was initially added by clicking a different button. Although I can successfully add a new section ...

Having trouble accessing a React component class from a different component class

I just started learning reactjs and javascript. For a simple project, I'm working on creating a login and registration form. The issue I'm facing is that when a user enters their email and password and clicks 'register', instead of movi ...

Utilizing Angular's ngShow and ngHide directives to hide spinner when no data is retrieved

I'm having an issue with the HTML code below. It currently displays a spinner until a list of tags is loaded for an application. However, the spinner continues even if no events exist. I want to make the spinner disappear and show either a blank inpu ...

Using React and Typescript: Populating an array within a For Loop using setTimeout is not happening sequentially or at all

I'm currently working on a function that animates images of random cars moving across the screen. My goal is to stagger the population of the "carsLeft" array using setTimeout, where I will eventually randomize the delay time for each car. Everything ...

Need Some Help Reversing the Direction of This CSS Mount Animation?

Exploring this fiddle, I encountered a small div showcasing an opacity animation. The animation smoothly executes when the state transitions to true upon mounting the component, causing the div to fade in beautifully. However, I faced a challenge as the an ...

There seems to be a problem fetching the WordPress menus in TypeScript with React and Next

Recently I've started working on a project using React with TypeScript, but seems like I'm making some mistake. When trying to type the code, I encounter the error message: "TypeError: Cannot read property 'map' of undefined". import Re ...

Retrieving Text following an HTML Element with a Parsing Tool

I'm currently utilizing PHP Simple HTML DOM for the development of a web scraper application. Here is the HTML structure from which we need to extract the City/State name, such as "Daviston, AL" in the example below. Can anyone assist me wi ...

Adaptable images - Adjusting image size for various screen dimensions

Currently, my website is built using the framework . I am looking for a solution to make images resize based on different screen sizes, such as iPhones. Can anyone suggest the simplest way to achieve this? I have done some research online but there are t ...

Incorporate HTML and React JS dynamically through AJAX response

Is there a way to activate React JS after inserting AJAX response into a page? The page consists of only a div and script tag as shown below; <div data-react-class="example" data-react-props="{}" data-react-cache-id="example-0& ...

How do you insert a button into a table using react and coreui?

I have implemented a table to display some data: The data is being displayed properly. My goal is to add a remove button on each row of the table. When the button is clicked, an onClick function should be executed to send a remove request to the server a ...

Text alignment issue in Material UI Data Grid Component

Currently, I am working with a DataGrid component nested inside a div that is enclosed within a Box component. I am facing issues in centering the content of the DataGrid and styling the header text. The code snippet I'm using is: Blockquote <B ...

Retrieve isolated scope of directive from transcluded content

I am not certain if it is possible, but I am essentially looking for a reverse version of the '&' isolate scope in AngularJS. You can check out this Plunkr to see an example. In essence, I have created a custom directive that provides some r ...

Newbie React Developer Struggling to Implement Material-UI Example in React Project, State Functioning Differently from Hooks

I am currently in the early stages of learning React and trying to create a form for a project management web application. For this, I am using material-ui library. I referred to one of the select box component examples from the material-ui documentation ...

Adjust div height to match the dynamic height of an image using jQuery

I'm facing an issue with my image setup. It has a width set to 100% and a min-width of 1024px, but I can't seem to get the 'shadow' div to stay on top of it as the window size changes. The height of the shadow div also needs to match th ...

Is Next _app.js optimized for mobile devices?

Currently in our CRA app, we manage responsiveness through a context provider that relies on the client width. Transitioning to Next (exciting!) made me realize that the following code will not function inside _app.js import "../styles/globals.css&qu ...

Guide on embedding styles within the shadow DOM of MUI material v5 in a React custom element using an insertion point

In the past, I successfully created a custom element using webpack and babel with @material-ui/core V4 (specifically 4.12.3). The styling for this custom element was done using @material-ui/core makeStyles. However, I am now upgrading to @mui/material v5 a ...

Choose the camera when utilizing the navigate.getUserMedia() function

I am currently utilizing the navigate.getUserMedia() method to record video on my mobile device and perform additional processing on it. However, at the moment, it is only capturing video using the front camera. How can I make it switch to the rear facing ...