Is there a way to utilize Material UI React Grid, which incorporates CSS Flexbox, in order to achieve a specific grid layout where items are wrapped and evenly spaced?

Currently, in my React project, I am incorporating Material UI React. I am working with the <Grid> component to create a flexbox layout with 10 items.

I am facing some difficulties in achieving a perfect grid layout with evenly spaced items. The layout looks good with 10 items arranged in 2 rows of 5, but as I try to make it responsive, the grid gets distorted. In the image provided, you can see my closest attempt, but there is still a lot of blank space on the right side that I want to eliminate.


https://i.sstatic.net/4CKov.png


I made another attempt, but the last row is not what I desire:

https://i.sstatic.net/sIRjb.png

Answer №1

Experiment with using justify={'space-between'} or justify={'space-around'} as attributes of the main grid component

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

Steps for printing a web page with a custom stylesheet instead of the default print.css file

I have a print.css file that handles printing website pages, but I now want to create a basic-print.css file specifically for printing out basic information. How can I add a button to the page that triggers the print functionality using basic-print.css ins ...

Switch between various components using multiple buttons in Next.js

I am in the process of creating a component that will display different components depending on which button the user selects. Here are the available “pages”: ` const navigation = [ { name: "EOQ", return: "<EOQgraph />" }, { nam ...

Issues with margin and padding-top not functioning properly when using @media for printing

Is there a way to add some space between the top of my webpage and my logo? I've tried adjusting the padding in my CSS, but when I check the print preview in Chrome, no spacing is visible. Below is my HTML code: <div class="container"> < ...

The "loadMore" property in AntD List

Any advice on implementing the loadMore prop in AntD using List when already having an api with limit set? I am using the fetch API instead of Reqwest like shown in the AntD example Here is the code snippet for my component: <List itemLayout="horizon ...

Removing the Scroll Bar from the body of a page in React.js: A step-by-step guide

I'm encountering an issue with unnecessary scrolling on the page. I've tried different options like using overflow:'hidden', but the problem is that other JavaScript components within the same class are displaying correctly: Here' ...

Create a ReactJs hierarchical tree component that illustrates the relationship between employees and managers

I need to create a ReactJs Tree component using Material UI that displays managers and their employees. When a manager is clicked, the component should expand to show all employees reporting to them. How can I achieve this with the provided data structure? ...

Error: Attempting to access properties of an undefined variable (specifically, the 'includes' property)

I've been encountering this TypeError and despite my efforts, I haven't been able to resolve it. Below is the code where the error is occurring. I have attempted to assign a variable to it based on suggestions from other similar posts, but unfort ...

Question about using React, NPM, Vite, Babel, and Node.js together

I want to confirm my understanding. So, if I decide to create a react 'app' and incorporate babel for jsx support. Then, I opt for vite for enhanced development runtime and packaging. Lastly, I utilize node.js to execute my code. To sum it up, ...

Dropdown Box Linking and Input Field Integration in HTML

I have a scenario where students need to pay monthly fees for their classes. My objective is as follows: 1. Dropdown #1: Student Names 2. Dropdown #2: Month Names 3. Textbox: Fees amount for the selected month The code I am using: $(document).ready(fu ...

Selecting the label "for" will activate both the anchor tag and input tag simultaneously

It seems like I'm having trouble making this work, and it appears to not be possible. That's why I'm reaching out for help... Here is the CSS that is being used: label.btn { cursor:pointer; display:inline-block; } label.btn>inpu ...

How can we use jQuery to extract an HTML element's external stylesheet and add it to its "style" attribute?

My goal is to extract all CSS references from an external stylesheet, such as <link rel="stylesheet" href="css/General.css">, and add them to the existing styling of each HTML element on my page (converting all CSS to inline). The reason for this re ...

Tips for preventing extra whitespaces and line breaks from being added to the render tree in Blazor applications

Consider the code snippet below <div> @for (int i = 0; i < 10; i++) { <span class="@classes[i]">@i</span> } </div> The desired output is (with each character styled differently) 01234567890 Howev ...

extracting data from checkbox to use in an angular function upon being selected

Currently, I am creating a list of checkboxes with distinct string values: heading, paragraph, list, table, visualtitle. I believe the current approach using (change)="onChange('heading', $event.target.checked) may not be the best way to han ...

Adding space between Bootstrap columns to align them one below the other on small devices

https://i.sstatic.net/turhY.png Within this illustration, there are two columns - one with the class col-sm-3 and the other with col-sm-8, situated in a single row. Upon resizing the window (as shown in the screenshot provided), the two columns appear ...

Creating column gaps that remain consistent when resizing a webpage is essential for maintaining a clean and organized layout

Visit my current site [This is the HTML code for my website:][2] <div class="column-box" style="width: 100%"></div> <div id="column1" style="float:left; margin:15; width:33%;"> <p>Sara Adams<br> I am a Web Developer and C ...

Ensure that the sidebar in your React application occupies the full height of the page, regardless of the presence of scrolling

In my application, most of the pages fit within the viewport which is why I have been using height: 100vh for my <SideNav /> component. However, some pages now require scrolling and this causes issues with the sidebar as it abruptly ends when scrolli ...

Is React Context malfunctioning due to a syntax error?

Using the function "login" from React context is causing an error for me: const handleLogin = async (data: LoginType) => { try { await login(auth, data.email, data.password); router.push("/Dashboard"); } catch (error: an ...

When I hit the back button in my browser, it unexpectedly resets my progress instead of navigating back

As part of my React website, I have implemented a video carousel that allows users to navigate through different videos using "Next" and "Prev" buttons. The current video's URL is stored in the state, so when the user clicks on either button, the stat ...

Checking the image loading functionality with Cypress

I am interested in testing Cypress to verify that an image is successfully loaded onto a page. Here is a snippet of my source code: import React from "react"; export default class Product extends React.Component { render() { return ( <div ...

Troubleshooting the installation error for 'react-router-dom

I encountered an issue during the installation of react-router-dom. D:\react\routeingreact>npm i react-router-dom npm ERR! Cannot read property 'match' of undefined npm ERR! A complete log of this run can be found in: npm ERR! ...