The absence of Div in the grid

I am working on developing a website that includes a photos page. I want to format the photos page with a grid layout similar to Instagram:

However, I'm encountering an issue where the div elements are not being displayed within their parent div as intended:

This is how my code currently appears:

.PhotosPage{
  width: 100vw;
  height: 100vh;
  display: flex;
}

.Photos_Container{
  display: grid;
  width: 100vw;
  grid-template-columns: 200px 200px 200px;
  grid-template-rows: 200px 200px 200px;

}

.Photos{
  width: 200px;
  height: 200px;
  background-color: #000;
}
<div className="PhotosPage">
  <div className="Photos_Container">
    <div className="Photo"></div>
    <div className="Photo"></div>
    <div className="Photo"></div>
    <div className="Photo"></div>
    <div className="Photo"></div>
    <div className="Photo"></div>
    <div className="Photo"></div>
    <div className="Photo"></div>
    <div className="Photo"></div>
  </div>
</div>

I would appreciate any feedback on what might be causing this issue. Thank you!

Answer №1

.Photos needs to be changed to .Photo

.PhotosPage{
  width: 100vw;
  height: 100vh;
  display: flex;
}

.Photos_Container{
  display: grid;
  grid-gap: 10px;
  width: 100vw;
  grid-template-columns: 200px 200px 200px;
  grid-template-rows: 200px 200px 200px;

}

.Photo{
  width: 200px;
  height: 200px;
  background-color: #000;
}
<div class="PhotosPage">
  <div class="Photos_Container">
    <div class="Photo"></div>
    <div class="Photo"></div>
    <div class="Photo"></div>
    <div class="Photo"></div>
    <div class="Photo"></div>
    <div class="Photo"></div>
    <div class="Photo"></div>
    <div class="Photo"></div>
    <div class="Photo"></div>
  </div>
</div>

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

i18next translations are experiencing issues when applied to imported components sourced from a design system library

In my development environment, I am utilizing a robust design system that incorporates Storybook, React, TypeScript, and Material UI v5 for a range of applications. This design system is compiled into a library with its own set of translations managed by i ...

Counting JQuery Classes in an HTML Document

My task involves creating a dynamic HTML form that allows users to enter card values, which are then counted and styled accordingly. Each set of cards is contained within a <section> element. However, I encountered an issue with my jQuery code where ...

Differences in React projects utilizing materialize-css compared to those using react-toolbox or material-ui

Is there a difference in technical benefits or code reliability when directly using material-css in JSX versus utilizing JSX specific libraries like material-ui or react-toolbox? Conversely, could using JSX libraries like material-ui or react-toolbox provi ...

Concealing the toolbars on iOS 7 with the overlay technique

After researching on Stack Overflow and Google, I have been trying to find a reliable method to hide the toolbars on iOS 7 since the old scroll trick is no longer effective. I came across this resource: I attempted the following code: <!doctype html& ...

Having trouble with a Parsing Syntax Error related to "Export Default" in React Native Typescript?

I am encountering an issue with my React Native project when transpiling Typescript code. The error occurs in the simulator during build, and seems to be related to using export default in Typescript for component export. This error arises as a parsing iss ...

In my React application, I have integrated p5 sketches that constantly loop and repeat

Currently facing a challenge integrating p5 sketches into my React App. I've tried adjusting the z Index of the toolbar to place the p5 elements underneath, but they end up repeating instead. Check out the repository here (sketches can be found in the ...

Ways to prevent users from selecting dates that are over a year from the present date in a datetime-local TextField

I am currently working on a feature to disable dates that are in the past and more than 1 year from the current date. While I have successfully managed to disable past days, I am facing difficulties in disabling dates that are further than 1 year into the ...

Adjusting the size of a Video/Image Slider to perfectly fit the screen dimensions (both width and height

I have been using a slider code to display my images and videos. The code can be found here: Code:https://codepen.io/1wdtv/pen/jbjZeb The issue I am facing is that the slider is only responsive in terms of width. This means that when resizing the browser ...

Customize the progress bar color in Bootstrap by setting a unique color to it

Is it possible to apply a custom color to the progress bar in Bootstrap that is not one of the standard options like success, info, warning or danger? I attempted adding the following code snippet to my bootstrap-theme.css file: .progress-bar-custom { b ...

How can I make the divs resize automatically and have them equal in height when the window is resized?

I need to adjust the height of three column divs so that they are all equal. Initially, I was able to achieve this using a function found on SO (apologies for not being able to provide attribution at this time, will update if possible): function resizeIt( ...

Animated Gradient Header with CSS

I've been attempting to add an animated gradient to my header class, but so far I haven't been successful. I want the gradient to apply only to the header, not the body. Here's the link I'm using for reference: Can anyone offer some i ...

How can the toolbar columns menu be displayed by clicking on a custom button located outside the DataGrid in Material UI?

Hello, I was curious if it is feasible to activate certain DataGrid menus by clicking a custom Button that is located outside the component. Thank you in advance. I am unsure of what else to include here, as it is prompting me to write more. It's a b ...

Javascript : an operation which combines two separate functions

Trying to create a function named "sendAndMove" that involves two other functions working in a specific order: setting() followed by goHome(). However, the initial code executes them in the reverse order - goHome() first, then setting(). Asynchronous featu ...

Receiving an error when attempting to import a function and access props using the "this" keyword: "TypeError: Unable to retrieve property 'renderElapsedString' as it is undefined"

Just started using React and working on a time tracking app based on the teachings of FullStackReact. Instead of Create Class, I opted for the ES6 'extends' module. However, I've encountered an error that has got me stumped. Error: Unable ...

Initiate a CSS animation within an iframe once the iframe becomes visible on the screen

Currently, I am working on creating HTML5 banner ads for Google AdWords using CSS animations. One challenge I have encountered is that due to the time restrictions of 30 seconds for animations in each ad, users may not always see all stages of the animatio ...

Failure of React to pass on state changes to child component

As I dive into the realm of React, I have encountered a peculiar issue. The challenge lies within the component below, which is responsible for rendering a list of fonts extracted from an array provided by the "Fonts" import. To display these fonts, I ut ...

Previewing images with Dropzone through extending file types

Want to display an image preview before uploading using dropzone. Attempting to access the images by calling file.preview but encountering the error "it does not exist on type File." Dropzone extends the file type with a preview?: string. How can I access ...

Retrieving CSS properties of an element using JavaScript

How can I efficiently retrieve all CSS rules associated with a specific element using JavaScript? I am not seeking a particular solution, just looking to capture all CSS rules for the given element. For example, consider the following HTML code: <div ...

Consistent design elements shared among various Angular components

I am faced with a scenario where I have around 6 components in HTML that share the same styling, such as: <headertag>Some Content</headertag> <headertag>Some subtitle</headertag> Here there might be different content or svg/img or ...

Using React.js to compare values in a switch statement

I've made some changes to the code, removing breaks, leaving one at the bottom, and altering the order of cases. I've also switched between greater than/less than comparisons. Including breaks will determine whether it hits the first or last case ...