Questions tagged [css-grid]
CSS grid layout is a W3C technology that allows for the creation of grids. It eliminates the need to use floats, tables, absolute positioning and even flexbox for building all sorts of grids, from simple to complex. Do not use this tag for CSS grid systems in general.
css-grid
6,282
questions
0
votes
1
answer
29
views
Tailwind: dynamic grid columns with no gaps
The documentation is not very clear about all the grid options there.
I have this grid template in alpinejs styling it with tailwind:
<div x-show="multiple" class="w-auto grid mt-3&...
1
vote
4
answers
55
views
How to float elements from bottom left corner to top right corner
Is there a smart and simple way to float elements from bottom left corner to top right corner?
My solution with display:grid is too static and has fix cols and not more than 10 items. I`m searching ...
1
vote
0
answers
18
views
CSS Resize grid cell based on image content
I have the following basic HTML + CSS of a grid with 2 columns and 3 rows:
<div class="container">
<div class="inner-container"></div>
<div class="...
-1
votes
1
answer
33
views
Data table using CSS Grid and Div elements [closed]
I created a data table using CSS Grid and Div elements. Previously, I used Display Flex, but I had trouble implementing rowspan and colspan with Div elements.
.grid-responsive {
overflow-x: auto;...
0
votes
2
answers
46
views
Grid Template Layout - aligning multiple items in same column (self align start)
I'm trying to use grid template to build a layout for different views (mobile / desktop etc).
I'm using grid-template-area.
For mobile it is easy since I'm using just 1 column but when I go to desktop ...
1
vote
3
answers
53
views
Reordering columns in CSS grid
I have the following HTML:
<ul>
<li>
<p>A</p>
<p>B</p>
<p>C</p
<p>D</p>
</li>
<li>
<p>AAA</p>
...
1
vote
1
answer
52
views
Vertical alignment by baseline in css grid doesn't work in Firefox and Safari when height is not defined
I need to arrange multiple items with pictures and titles in a row of a grid like this:
The aspect ratio of the pictures is known.
The amount of columns is known.
The grid's width is inherited from ...
1
vote
0
answers
25
views
Translate element depending on its position in css-grid in react
I have an app component that contains a parent element, which is a css-grid container. Inside the parent, I have a couple of box elements. The layout is set up so that each box is 100px x 100px large,...
1
vote
1
answer
64
views
CSS sticky cards using grid layout
I want to have a layout of sticky cards using grid layout. This is what I managed to achieve:
for (const cards of document.querySelectorAll(".cards")) {
let i = 0;
for (const card of cards....
0
votes
0
answers
32
views
grid-auto-flow: dense not working with responsive grid layout
In my responsive two column layout, I want items to have their own height, I don't want them to share the same height of the items next to them. I'm using Tailwind, JavaScript & React. ...
0
votes
2
answers
79
views
How to place a single item on a responsive grid row?
I am using a grid to place cards. The grid is responsive using minimax and auto-fit:
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
But, I would like to have a single card in the first ...
0
votes
1
answer
22
views
Cell in css grid overflow if align-items: end is set
When I use align-items: end in my example, the content overflows and I have no idea why. I expect the same behavior as with align-items: start. I tried setting the width but I couldn't find a solution....
-2
votes
3
answers
59
views
Change background colour of certain row
I have this code and I want to change the background colour of the fifth last row. I know I need to use nth-last-child.
Someone can tell me the code?
.grid-container {
display: grid;
grid-...
0
votes
1
answer
39
views
How can I change col/row behavior based on available space?
I have a set of cards, whose have their own cards, like this (i am using TailwindCSS btw):
<script src="https://cdn.tailwindcss.com"></script>
<div class="grid grid-cols-3 gap-4">...
1
vote
2
answers
65
views
CSS grid/flex shrink based on content but grow evenly
I am building a Navbar for my app. I would like to have my items shrink based on their content but grow based on the average size.
All I want is:
if there is enough space for all items to be max-...