The CSS Grid is too small to accommodate the Grid Item, even though there is ample space available

I'm currently working on a grid system where the first part (one to five) should be the opposite of the second part (six to ten). I have successfully set up the first part, but I'm struggling with fitting the tenth piece into the grid. I attempted to adjust the grid row for that element, but it didn't work out as expected. Can anyone provide some guidance on how to resolve this issue?

https://i.sstatic.net/04gPh.png

.wrapper {
  margin: 0 auto;
}

.wrapper > div {
  background-color: rgba(233 171 88 / 0.5);
  color: #d9480f;
  aspect-ratio: 1 / 1;
  border:1px solid black;
}

.wrapper {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
/*   grid-template-rows: repeat(12, 1fr); */
  gap: 5px;
}


.one {
 grid-row: auto / span 6
}

.three {
 grid-row: 7 / span 6
}

.one, .three {
 grid-column: auto / span 6;
}

.two {
 grid-column: auto / span 8;
 grid-row: auto / span 8
}

.four, .five {
 grid-row: 9 / span 4;
 grid-column: auto / span 4
}

.six {
 grid-column: auto / span 8;
 grid-row: auto / span 8;
}

.seven {
  grid-row: auto / span 6;
}

.ten {

}

.seven, .ten {
  grid-column: 9 / span 6;
}

.eight {
 grid-column: 1 / span 4
}

.nine {
 grid-column: 5 / span 4
}
<div class="wrapper">
  <div class="one">One</div>
  <div class="two">Two</div>
  <div class="three">Three</div>
  <div class="four">Four</div>
  <div class="five">Five</div>
  <div class="six">six</div>
  <div class="seven">seven</div>
  <div class="eight">eight</div>
  <div class="nine">nine</div>
  <div class="ten">ten</div>
</div>

Answer №1

To tackle a grid layout as intricate as this, it's advisable to sketch it out on paper first before delving into the CSS coding. It is recommended to specify the row and column configurations for each box individually rather than relying on the automatic settings.

.wrapper {
  margin: 0 auto;
}

.wrapper > div {
  background-color: rgba(233 171 88 / 0.5);
  color: #d9480f;
  aspect-ratio: 1 / 1;
  border: 1px solid black;
}

.wrapper {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
/*   grid-template-rows: repeat(12, 1fr); */
  gap: 5px;
}


.one {
 grid-row: auto / span 6
}

.three {
 grid-row: 7 / span 6
}

.one, .three {
 grid-column: auto / span 6;
}

.two {
 grid-column: auto / span 8;
 grid-row: auto / span 8
}

.four, .five {
 grid-row: 9 / span 4;
 grid-column: auto / span 4
}

.six {
 grid-column: auto / span 8;
 grid-row: auto / span 8;
}

.seven {
  grid-row: auto / span 6;
}

.ten {
  grid-row: 19 / span 3;
}

.seven, .ten {
  grid-column: 9 / span 6;
}

.eight {
 grid-column: 1 / span 4;
}

.nine {
 grid-column: 5 / span 4;
}

.eight, .nine {
 grid-row: 21;
}
<div class="wrapper">
  <div class="one">One</div>
  <div class="two">Two</div>
  <div class="three">Three</div>
  <div class="four">Four</div>
  <div class="five">Five</div>
  <div class="six">six</div>
  <div class="seven">seven</div>
  <div class="eight">eight</div>
  <div class="nine">nine</div>
  <div class="ten">ten</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

Troubleshooting varying screen sizes in CSS

I am in the process of designing a contact page for my website and facing challenges with its responsive design across different screen resolutions. My laptop has a resolution of 1368x766 while my monitor is set at 1920x1080. The absolute positioning of ...

Exporting a web page as a Microsoft Word document is not working properly because

Need assistance with exporting a webpage to Microsoft Word in table format, as the table layout is not displaying correctly and is missing CSS styling. Can someone please help me resolve this issue? ...

Is it possible to simultaneously execute an animate and a fade out effect?

Is there a way to simultaneously move "app1" to the left and fade it out? Currently, the functions are executing one after the other. I want them to occur simultaneously, without the left movement happening before the fade out. Thank you! <!DOCTYPE h ...

Ways to determine if a Less file matches the compiled CSS file

Recently, I inherited a website that utilizes LESS for CSS pre-processing. My task involves updating certain styles; however, I am uncertain whether the former developers made changes to the LESS files and then compiled the CSS, or if they simply edited th ...

Modifying a variable when a specific number of elements are clicked using jQuery

I have created a script for my portfolio that is functional but I want to streamline it so that I only need to edit the HTML, not the script itself. The main requirements for the code are: Count the number of <img> tags within the element with id ...

I'm having trouble adjusting the link color in my footer text while navigating Wordpress for the first time

As someone who is new to Wordpress, I am struggling with changing the link color in the footer text. Despite spending hours on it, I just can't seem to figure it out. The files I have been working with are style.css and bootstrap.min.css. I feel lik ...

Sending jQuery variables to PHP

Is it possible to transfer a jQuery variable to a php file? Let's take a look at the code in my_js.js: function updates() { $.getJSON("php/fetch.php", function(data) { $.each(data.result, function(){ var s_id = this[& ...

Delayed Page Update: Click Event Doesn't Execute Correctly Without JQuery

I'm a beginner in JavaScript and unable to use JQuery I have a table and I want to highlight the selected row on the click event. At the same time, I need to change the value of an input field. However, when I click on a row, the highlight effect get ...

Circular images linked by lines in bootstrap styling

I am attempting to create a layout like this: https://i.sstatic.net/vKNWN.png Here is my attempt at achieving the same I'm having trouble figuring out how to align the blue circle with the rounded image in Bootstrap and place text on top of lines, ...

Utilizing Ajax Blob URL for Audio Streaming

My goal is to retrieve audio data using an Ajax request and load it into an audio element. However, I'm running into an issue where the player does not seem to work properly. The play button remains disabled as if nothing has been loaded. Below is a s ...

Create a div element that is set to be 30 pixels smaller than its containing div

I am trying to achieve a specific layout where I have a nested div structure. The parent div has a width set in percentage (80%) and I want the child div to be slightly narrower by 30px. Can anyone provide guidance on how I can accomplish this? Do I need ...

Unique style pattern for parent links with both nested and non-nested elements

I am in the process of designing a website and I have a specific vision for how I want my links to appear, but I am unsure of how to achieve it. Here is the desired outcome: a red link a green link a red link a green link … Below is the HTM ...

Increasing the boundary width beyond a specified limit with CSS

Need help extending the border-top of an element beyond a container width set to 1024px, while maintaining center alignment on the page with left alignment. Thank you! Here is the code snippet: HTML <main> <div> <span>Hello& ...

SweetAlert html is not recognizing ng-app, but it functions correctly within the html body

When inserting a bootstrap table inside a SweetAlert, I encountered an issue where using ng-app or ng-repeat to populate data inside the table's rows did not call ng-app. However, when populating the table outside of the SweetAlert in the body, ng-app ...

Manipulating SVG filter attributes with CSS: A comprehensive guide

In my quest to master CSS animation, I found myself needing to manipulate the values of SVG filter attributes. While attempting to reference a CSS variable within the specularConstant attribute, I encountered an error from the browser. Is it feasible to ...

The CSS files are not loading automatically in my React application using Vite

I am facing an issue with importing css and js files into a view in React using vite. The styles are not loading properly, and I have to keep commenting and uncommenting the imports in my code for them to be recognized when entering the view. Below is a s ...

Guide to activating text entry following selection of a related radio button in Bootstrap 4

I am currently utilizing Bootstrap 4 to create a mock item submission form for my web application. Within the transaction row, the text input field for price is initially disabled by default. What steps should I take in order to enable the text input field ...

VueJS - apply a rotation animation before showing the element

I'm having trouble displaying a line in different directions. While vertical and horizontal lines work fine, the diagonal direction requires rotation before it appears correctly. The issue is that it initially displays vertically before rotating to 13 ...

The Angular carousel fails to display or operate properly

I am encountering an issue where the content is not displaying when using the angular-carousel directives: <ul rn-carousel rn-carousel-controls rn-carousel-index="carouselIndex" rn-carousel-buffered > <li ng-repeat="slide in slides track by ...

Display HTML content in a UITableView using local resources

I am working on a simple app where I created a UITableView and DetailViewController. In DetailViewController, I defined variables int *webNumber and UIWebView *webName in the headers. DetailViewController.m switch (webNumber) { case 0: } Can someone ...