What is the best way to ensure that each box remains separate and does not overlap with the box next to it?

Just an FYI - styling in React using CSS is quite similar to regular CSS. Each individual box has its own code snippet:

  export const CardWrapper = styled.div`
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 4px;
  background: ${(props) => props.theme.colors.backgrounds.project};
  padding-bottom: 28px;
  padding-right: 0px;
  height: 300px;
  width: 375px;
`;

Every box should follow this format: https://i.sstatic.net/51OlN.jpg

However, when increasing the width as shown in the image below, there should be black lines separating each box: https://i.sstatic.net/xSN3y.jpg

  export const DeploymentsWrapper = styled.div`
  display: grid;
  grid-template-columns: repeat(auto-fill, 335px);
  grid-gap: 20px 30px;
  max-height: inherit;
  width: 100%;
  box-sizing: border-box;
  padding: 13px 30px 30px 30px;
`;

https://i.sstatic.net/uT4ld.jpg

Answer №1

To ensure consistency, specify a max-width of 100% for your card elements.

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

react-google-maps: displaying numerous info windows

I have a simple question about implementing react-google-maps with multiple markers and info windows. Here is the code snippet I am using: const MapWithADirectionsRenderer = compose( withProps({ googleMapURL: "https://maps.googleapis.com/maps/ ...

The alphanumeric regex format is not displaying the password validation message

My issue is that the password validation message is not being triggered when I enter only letters or numbers in the password field. Ideally, I want the validation message to show if the password is not alphanumeric. I am currently using react-hook ...

Using React Context to trigger a state change when a button is clicked

As I navigate my way through the React ecosystem as a newcomer, I find myself using a React Context to handle state management in my Next.js App. The challenge lies within my Context file: import { useState, createContext, useContext } from "react&quo ...

When hovering, the <a> element does not fully encompass the background color

I am currently working on a navigation bar that changes the background color of the links when hovered. However, I encountered an issue where the dropdown menu in the navigation bar does not cover the entire area. body { margin: 0; font-family: Aria ...

Switching the sorting criteria from 'AND' to 'OR' in the JPList library

I am currently exploring the use of JPList to sort on multiple items. As it stands, JPList searches like 'AND' when sorting (e.g. sorting based on an item with tags html, php and jQuery all together), but I am interested in filtering through all ...

I'm experiencing an issue with uploading an image to Firebase as I continue to encounter an error message stating "task.on is not a function."

The console displays a message confirming a successful upload. const sendPost = () => { const id = uuid(); const storage = getStorage(); const storageRef = ref(storage, `posts/${id}`) const uploadTask = uploadString(storageRe ...

Ways to eliminate the default underline in MUI typography

I have a unique Moviecard component in my React app that I built with MUI. It has this persistent and bothersome underline on every Typography component, and no matter what I try, like setting textDecoration to none, it just won't go away. There seem ...

Encountered an error at "emitErrorNT (node:internal/streams/destroy:151:8)" while attempting to develop a Next.js website

While working on my nextjs website, I encountered the following error: at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/proces ...

Avoiding HTML (JSX) tag duplication in React Component

Having the same code in my React component multiple times is becoming repetitive and inefficient. Is there a way to follow the DRY principle and avoid repeating this code? While creating a landing page with Sass styling, I noticed that I am duplicating t ...

Is there a way to showcase the value of this.state in save.js?

I'm currently exploring React and have a question regarding displaying the values of this.state in my WordPress frontend. Specifically, I am working on save.js. In edit.js: import apiFetch from '@wordpress/api-fetch'; const { Component } = ...

Organizing knockout data outcomes into two separate columns

Is there a way to split up this code into two columns using Knockout and HTML? I can do it easily in CSS, but the goal is to divide the results into segments 1-5 and 6-9. Here is the code snippet. Also attached is a screenshot for reference. Thank youhtt ...

Attempting to incorporate two distinct functions, each with its own button that targets a specific component in ReactJS

As I try to update the background of a JSX element, I encounter an issue with two functions. The first function turns the background gray while the second one turns it green. I have successfully added both functions to the JSX element using onClick, but ...

The card header in Bootstrap card grid does not have the ability to extend all the way to the edge of

Utilizing bootstrap 4 within Laravel, I create blade.php template files. Here is a snippet of my code. The card grid layout appears satisfactory, however, there seems to be some empty space between the card titles and the edges of the cards. <div id=" ...

Error: React JS is unable to access the property 'path' because it is undefined

Currently, I am encountering an issue while setting the src of my image in React to this.props.file[0].path. The problem arises because this state has not been set yet, resulting in a TypeError: Cannot read property 'path' of undefined. To provid ...

Fresh Redux shop in stealth mode

I am managing a Single Page Application using React and Redux. Some customers have expressed interest in keeping two separate instances open with distinct credentials (one in normal view and one in incognito mode on Chrome). As both instances can access t ...

What are some ways to monitor app activity across all pages without relying on client timestamps?

I'm looking for a way to track the work time of my app across all components without causing constant rerenders. I know that using a store is one solution, but updating the variable would trigger rerenders every second. Can you suggest an alternative ...

Shades of Grey in Visual Studio Code

Whenever I use VSC, I notice these odd grey boxes that appear in my editor. They seem to be dynamic and really bother me. Interestingly, switching to a light theme makes them disappear. However, I prefer using a dark theme and haven't been able to fin ...

Navigating to different sections of a single page using Bootstrap

I'm feeling a bit lost when it comes to understanding how linking to an element within a page functions. As I delve into the starter template for Twitter Bootstrap, I encounter the following code snippet in the navbar: <ul class="nav navbar-nav"&g ...

Is there a way to prevent the window.status from appearing?

I currently have the following code snippet: <a class="button accessLink" id="loginLink" href="#" data-action="Login" data-dialog="access" data-disabled="false" data-entity="n/a" ...

Creating a Horizontal Separator with Material UI in React

I am currently working on a menu component for Storybook where I have mapped icons and text. The issue I am facing is that there is a horizontal divider between them, but I want it to look like the image provided. In the Storybook, I need to map various me ...