css-grid

Relation between grid-template-areas and grid-template columns

喜欢而已 提交于 2021-02-10 06:42:16
问题 I am new to coding and don't seem to understand the CSS Grid model correctly. In the code below the grid is divided into 3 grid-template-columns (300px each) but then there are 8 units per row in the grid-template-areas (for example: hd hd hd hd hd hd hd hd) and not 3 which does not make sense to me. Can somebody please help me understand why the number of units in the grid-template-area is not the same as the number of columns? (so it would be "hd hd hd" if there are 3 columns). What is

Relation between grid-template-areas and grid-template columns

扶醉桌前 提交于 2021-02-10 06:39:27
问题 I am new to coding and don't seem to understand the CSS Grid model correctly. In the code below the grid is divided into 3 grid-template-columns (300px each) but then there are 8 units per row in the grid-template-areas (for example: hd hd hd hd hd hd hd hd) and not 3 which does not make sense to me. Can somebody please help me understand why the number of units in the grid-template-area is not the same as the number of columns? (so it would be "hd hd hd" if there are 3 columns). What is

Four Column Layout that Converts to Single Column without Media Query

北慕城南 提交于 2021-02-10 03:23:26
问题 I'm trying to create a four column layout where each column grows and shrinks with the size of the window, but each column has a minimum width and when the window is too small for all four columns to fit in a single row, it transitions to a single column with each section taking up the full width. I've been unable to do this with either flex-box or CSS grid. And I'd like to do this without a media query. Using a media query would solve the issue pretty easily, but I don't like them! .col {

Four Column Layout that Converts to Single Column without Media Query

为君一笑 提交于 2021-02-10 03:20:25
问题 I'm trying to create a four column layout where each column grows and shrinks with the size of the window, but each column has a minimum width and when the window is too small for all four columns to fit in a single row, it transitions to a single column with each section taking up the full width. I've been unable to do this with either flex-box or CSS grid. And I'd like to do this without a media query. Using a media query would solve the issue pretty easily, but I don't like them! .col {

Filling cells starting from the bottom in CSS Grid

China☆狼群 提交于 2021-02-09 11:16:46
问题 I have a CSS grid with 3 rows. There may be less than 3 items to fill it, and I want to start filling it from the bottom. I've created a jsFiddle for you to play with, but it currently fails to do what I want. html, body, div { height: 100%; } div { display: grid; grid-template-columns: 1; grid-template-rows: repeat(3, 1fr); /* MISSING RULE */ } <div> <p>Last item</p> <p>Second last item</p> <p>Top item</p> </div> Actual output: Last item Second last item Top item Desired output: Top item

Filling cells starting from the bottom in CSS Grid

不打扰是莪最后的温柔 提交于 2021-02-09 11:15:58
问题 I have a CSS grid with 3 rows. There may be less than 3 items to fill it, and I want to start filling it from the bottom. I've created a jsFiddle for you to play with, but it currently fails to do what I want. html, body, div { height: 100%; } div { display: grid; grid-template-columns: 1; grid-template-rows: repeat(3, 1fr); /* MISSING RULE */ } <div> <p>Last item</p> <p>Second last item</p> <p>Top item</p> </div> Actual output: Last item Second last item Top item Desired output: Top item

Place wrapping items in the center of the grid

吃可爱长大的小学妹 提交于 2021-02-09 00:21:13
问题 I have a CSS Grid layout which looks like below: This works perfectly for me, but when I lower the resolution of the screen, the grid's responsiveness makes the grid look like this: Instead, I want the wrapping items to justify the left and right white spaces, and they should look like this: How can I achieve the above? The items are dynamic in number. There can be even number of items which will make it look better as the left and right white spaces will be equally spaced. But if the items

Place wrapping items in the center of the grid

浪尽此生 提交于 2021-02-09 00:20:18
问题 I have a CSS Grid layout which looks like below: This works perfectly for me, but when I lower the resolution of the screen, the grid's responsiveness makes the grid look like this: Instead, I want the wrapping items to justify the left and right white spaces, and they should look like this: How can I achieve the above? The items are dynamic in number. There can be even number of items which will make it look better as the left and right white spaces will be equally spaced. But if the items

Can I create a multi-column CSS page that wraps words based on page and column size?

可紊 提交于 2021-02-08 09:16:59
问题 I'm trying to create a page in CSS that looks like an old newspaper. My page should be responsive, and only have one column of text on small devices, but that is mostly irrelevant to the problem I'm asking for help with. On larger screens, the page should have either 2 or 3 columns, depending on the screen width. I'm able to achieve this with CSS columns... however, I would like to further complicate things by having the CSS columns wrap per page (defined as 100vh). My criteria are: Text

Can I create a multi-column CSS page that wraps words based on page and column size?

廉价感情. 提交于 2021-02-08 09:16:26
问题 I'm trying to create a page in CSS that looks like an old newspaper. My page should be responsive, and only have one column of text on small devices, but that is mostly irrelevant to the problem I'm asking for help with. On larger screens, the page should have either 2 or 3 columns, depending on the screen width. I'm able to achieve this with CSS columns... however, I would like to further complicate things by having the CSS columns wrap per page (defined as 100vh). My criteria are: Text