6,433 questions
1
vote
2
answers
107
views
Can CSS grid elements shrink at a known ratio?
I have a flexbox where all elements shrink proportionally (size ratio 2:1:2) and only one element grows if more space than 400px + 200px + 400px is available:
div {
outline: 1px solid;
}
<div ...
3
votes
1
answer
61
views
CSS subgrid items not flush with parent grid items
Background:
I am attempting to create a thumbnail view of an art portfolio, with thumbnails arranged in a 4×n grid. Some portfolio entries consist of a single image. Other portfolio entries consist of ...
0
votes
1
answer
53
views
How to make item in CSS Grid overflow and don't make the whole grid grow
I have two items in a grid. The top one, which has text, I want to fit the content. So it's responsive when I change the page width. The bottom one I would like to take the remaining space, but don't ...
-3
votes
1
answer
52
views
CSS grid-template-rows "min-content" not working [closed]
The fiddle shows that it is not working (tested in chrome and firefox) : https://jsfiddle.net/Flyout/8gsx36qc/4/
<div style="
display: grid;
grid-gap: 1rem;
grid-template-columns: 1fr ...
0
votes
2
answers
105
views
How to set grid-row on grids that are subgrids?
In this youtube tutorial the author sets grid-template-rows to auto auto auto such that the subgrid items get 3 rows each.
Then later he replaces the grid-template-rows:auto auto auto setting with ...
1
vote
2
answers
148
views
CSS Grid Layout- How to keep menu elements inside the navbar when being resized?
I'm practicing to build a website layout that's primarily structured with using CSS grids - a single-column, multi-row grid - with the following ideas:
1. The Navbar has a determined height
2. There ...
0
votes
1
answer
92
views
CSS grid adaptive cells [closed]
I'm trying to make sure the columns are the same width and can expand/contract freely as numbers are entered or deleted. I was able to achieve the desired behavior, but how can I prevent the right ...
Best practices
0
votes
3
replies
101
views
How to respect other elements when breaking out of container?
I got a layout that is two columns where the right column will contain some text and a header. The header should also have the possibility to either remain in its column or span across both columns ...
5
votes
3
answers
144
views
Why does a different row height in the 4th row change the row height distribution among the first three rows?
I have a Grid with two columns and 4 rows. The grid-areas are as follows
grid-template-areas:
"v p"
"v o"
"v t"
"m t";
I have one Item per area. So my item v (...
1
vote
1
answer
95
views
How to make position: sticky work inside a CSS Grid child with overflow?
I am trying to create a layout where the page height is fixed to the viewport (100vh), the .sidebar and .content areas scroll independently, and a .content-header inside .content should stay sticky ...
0
votes
1
answer
68
views
repeat(auto-fit, minmax(auto, 1fr) is not valid syntax
I want to create a grid with repeated columns. The columns should be as large as the children's content and then the remaining space in a track should be distributed.
I thought I could achieve this ...
1
vote
1
answer
72
views
Why does `line-height:1` cause overflow in this CSS grid?
I'm a little new to CSS grid stuff, so forgive me if this is obvious, but I haven't found a good explanation for this so far.
In my mind, line-height:1 basically means "use the normal value."...
0
votes
1
answer
88
views
I'm getting extra space following the content in a one column / two row cell [closed]
I have a 3 column by 4 row CSS grid. The cell in the first column spans two rows and I want the next row to be directly after the content in that first cell, but there's a space between the content ...
4
votes
2
answers
147
views
Right-align grid items
I've got this snippet:
.grid {
border: 1px solid #c5c5c5;
width: 220px;
display: grid;
grid-template-columns: 60px 60px;
grid-auto-rows: 40px;
row-gap: 10px;
column-gap: 10px;
...
1
vote
1
answer
138
views
How can I extend a CSS grid to create overhangs?
Semantically I have a table so I would use the HTML <table> element. For grouping rows I can use <tbody>:
<table>
<tbody>
<tr><td>A</td><td>...