• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Using minmax() functions in CSS grid

Resolved: Using minmax() functions in CSS grid

0
By Isaac Tonny on 16/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I have a grid with 2 columns x 2 rows. All of them are set in minmax() size. Can I ask why the element with class show doesn’t take the full size of the grid even though I set all other elements (hide class) in the grid to width 0 and height 0. Doesn’t minmax() work properly?


Answer:

The minmax() function is working fine. So is the calc() function.
The problem is a misunderstanding about the minimum height and widths that are set.
Even though you set the grid items to zero width and height:
…the grid columns have their own width and height:
The columns and rows aren’t shrinking to zero, which prevents .show from expanding across the entire container.
Consider using auto instead of minmax() in grid-template-*. That will enable the column / row to track the size of the grid item.
Also consider the solutions in these posts:
  • How to make a column span full width when a second column is not there? (CSS Grid)
  • Is it possible to hide columns with empty content via the grid-template-columns definition?
  • minmax() defaulting to max

If you have better answer, please add a comment about this, thank you!

css css-grid minmax
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: How to give rank on datetime column group by another column with userid in it

24/03/2023

Resolved: Passing 2 functions in onChange in react

24/03/2023

Resolved: Why doesn’t stringstream consume output during hex formatting?

24/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.