Adjusting the height of the divs on the right side of a 2x2 grid: Easy steps to follow

I have implemented a 2x2 grid in my HTML and CSS code:

<div className="gameScreen">
      <GameTable 
        seats={seats}
      />

      <ChatBox socket={socket} username={username} />

      <InfoTable numPlayers={numPlayers} seats={seats} timer={false}/>

      <GameCommands gameMasterSpeech={gameMasterSpeech}/>
    </div>
.gameScreen {
  display: grid; 
  height: 100%;
  width: 100%;
  grid-template-columns: 3fr 2fr;
  grid-template-rows: 4fr 1fr;
}

This setup creates a 2x2 grid where:

  • the first grid is 3fr wide and 4fr tall
  • the second grid is 2fr wide and 4fr tall
  • the third grid is 3fr wide and 1fr tall
  • the fourth grid is 2fr wide and 1fr tall.

I am looking to adjust the height of the second grid to be about 3fr, and the height of the fourth grid to be 2fr. How can I make this adjustment?

Answer №1

Finally cracked the code:

.gameScreen {
  display: grid; 
  height: 100%;
  width: 100%;
  grid-template-columns: 3fr 2fr;
  grid-template-rows: 1fr;
}

.gameScreen .left {
  display: grid; 
  height: 100%;
  width: 100%;
  grid-template-columns: 1fr;
  grid-template-rows: 3.5fr 1fr;
}

.gameScreen .right {
  display: grid; 
  height: 100%;
  width: 100%;
  grid-template-columns: 1fr;
  grid-template-rows: 3fr 2fr;
}
<div className="gameScreen">
      <div className="left">
        <GameTable/>
        <InfoTable/>
      </div>
      <div className="right">
        <ChatBox />
        <GameCommands />
      </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

Position the Bootstrap button on the right side

this is the code I am working with: <p class="h1 p-3 mb-2 bg-danger text-white text-danger">Lagerbestand unter Mindestmenge! </p> <br /> <div class="border text-center"> <p class="h5 text-center">Durc ...

The nested div within the ui-view element is failing to expand to the entire width of the window

I am facing a challenge in making a child div stretch to the entire width of the window, rather than just the width of its parent. I am incorporating AngularJS with UI-Router, and I'm not sure if that is causing the issue. Attached is a screenshot. ...

Quickest method to create a new empty stylesheet in the developer tool of Chrome's inspector ("Inspector stylesheet")

When testing CSS modifications live in Chrome, I typically use the following method: Right click > Inspect Then, I use the bottom right panel and click the + button to add a new class which I can edit directly. https://i.sstatic.net/VX57R.jpg Howe ...

Why are my CSS styles not appearing on the canvas with html2canvas?

Currently, I am in the process of developing a script that allows for image manipulation and saving. I have a main div where I set a background image, within which there is another div containing an image that can be manipulated (resized, rotated, and dra ...

Customizing the appearance of a Form.Check (checkbox) component in React Bootstrap

I am new to React and Bootstrap. I have a question about styling Form.Check (checkbox) components. How can I customize the default appearance to achieve a different look, such as a switch or another style? Here is what I have attempted so far (I tried app ...

What is the quickest way to select CSS elements?

Imagine having a popup element labeled as "popup" with two buttons inside, one positioned on the left and the other on the right side, both having the class "popupbutton". Which CSS rule would be the most optimal in this scenario? #popup a.popupbutton ...

Submitting a form from a local HTML file to an external URL using Ajax

I'm facing a bit of a dilemma with my project. I have a local HTML file that contains some Forms. All the stylesheets and JavaScript files are hosted on a web server. The issue arises when I try to submit the forms using AJAX while opening the HTML ...

Envelop the phrases onto a fresh line

I'm having trouble getting the text inside a div to display correctly. When the text is too long, it just keeps stretching instead of breaking into new lines. How can I make sure that the content displays as a block within the div? Thank you. .box ...

Concealing an interactive element using Javascript

I have a button in my most recent software that, when clicked, opens input popup boxes. Once these boxes are closed, how can I make the button disappear? ...

What is the best way to fill a JavaScript array with only the divs that are currently displaying as block elements?

In my JavaScript code, I am attempting to populate an array using jQuery. Within a <section> element, there are multiple <div> elements, but I only want to add the ones that are visible (with CSS property display: block) to the array. HTML: & ...

The issue of changing the body font size in MUI v5 with React Styleguidist, ScopedCSSBaseline, and createTheme style overrides remains unresolved

Recently, I successfully migrated two MUI-powered UIs from MUI v4 to v5. In the process, I had to override their body fontSize according to the MUI migration guide to maintain the v4 design default of Typography body2 font size. This adjustment has worked ...

The time allowed for the menu items to reveal their subitems may be delayed

I am facing an issue with my website where the menu items are displayed horizontally and each submenu is shown when a user hovers over them. However, I have noticed that when the user tries to click on the submenu item, it disappears too quickly. Is ther ...

Troubleshooting: Issue with Jquery functionality when selecting an item from dropdown menu

I've been trying to dynamically select an item from a dropdown menu, but for some reason it's not working even though I've followed the suggestions on this forum. Here is my HTML: <div> <div class="form-group"> <la ...

Tips for adjusting the horizontal position of a grid item within a map() loop

I am trying to align the text in my Timeline component from Material Ui always towards the center of the timeline. The TimelineContent contains Paper, Typography (for title and description), and an image. Currently, I have multiple TimelineContent element ...

Using PHP, HTML, and JavaScript to generate a dropdown list from a database

I am looking to create a dynamic dropdown list populated from a database using JavaScript. My goal is to design a form where users can add multiple rows by clicking the "add more" button. The form will include both a text input field and a dropdown list. ...

Enhancing the appearance of buttons with hover effects in Twitter Bootstrap

I am interested in customizing the hover button styling for Bootstrap v3.2. The default behavior is to darken on hover, but I would like to make it lighter instead. Although I checked the Buttons Less variables, I couldn't find an option specifically ...

What steps should be taken to acquire the most recent CSS files for a theme?

We are facing an issue with implementing a versioning system for our CSS files. Currently, we append a build number to the CSS link programmatically (e.g. \themes\ssss\abc.css?1011) so that clients always receive the latest CSS files with ea ...

What could be causing the malfunction of the Google Maps iframe, preventing it from displaying the location properly

I am having trouble with this Google Maps iframe, it doesn't seem to display the location properly. Why is that? <iframe src="https://www.google.com/maps/place/18%C2%B045'14.7%22N+98%C2%B059'44.0%22E/@18.7540995,98.9933669,17z/data=!3m1! ...

Is it possible to generate a triangular attachment below a div element?

My designer sent me a unique design and I'm wondering if it's possible to replicate using HTML, CSS, or JavaScript? https://i.stack.imgur.com/spB71.png I believe it can be done with CSS by creating a separate div positioned absolutely under the ...

"Enhance your website with Wordpress and Divi by adding dynamic image replacement on hover

In search of a code to insert into my project Utilizing images to create a large interactive button I'm currently using the divi code module within WordPress. I am seeking the ability to have an image switch with another image when hovering over it, ...