css-grid

How to dynamically Break FlexBox Column to start a new column

别说谁变了你拦得住时间么 提交于 2020-12-10 08:44:05
问题 I have a dynamic list of items (containing text) placed column-wise which I need to break after every 5 th item . I have only 2 constraints: Width of each Item is 100px - if the text overflows, it must wrap around to next line. Each column must contain at-most 5 Items. The number of items are NOT known. If there are less than 5 items in the list they can be kept in the same column. If there are more then they must wrap to next columns. Since I do not know the number of items or their content

How to dynamically Break FlexBox Column to start a new column

大城市里の小女人 提交于 2020-12-10 08:44:00
问题 I have a dynamic list of items (containing text) placed column-wise which I need to break after every 5 th item . I have only 2 constraints: Width of each Item is 100px - if the text overflows, it must wrap around to next line. Each column must contain at-most 5 Items. The number of items are NOT known. If there are less than 5 items in the list they can be kept in the same column. If there are more then they must wrap to next columns. Since I do not know the number of items or their content

Responsive CSS Grid with persistent aspect ratio

随声附和 提交于 2020-12-01 09:34:30
问题 My goal is to create a responsive grid with an unknown amount of items, that keep their aspect ratio at 16 : 9. Right now it looks like this: .grid { display: grid; grid-template-columns: repeat(auto-fill, 160px); grid-template-rows: 1fr; grid-gap: 20px; } .item { height: 90px; background: grey; } <div class="grid"> <div class="item"></div> <div class="item"></div> <div class="item"></div> <div class="item"></div> <div class="item"></div> <div class="item"></div> <div class="item"></div> <div

Responsive CSS Grid with persistent aspect ratio

孤街浪徒 提交于 2020-12-01 09:33:07
问题 My goal is to create a responsive grid with an unknown amount of items, that keep their aspect ratio at 16 : 9. Right now it looks like this: .grid { display: grid; grid-template-columns: repeat(auto-fill, 160px); grid-template-rows: 1fr; grid-gap: 20px; } .item { height: 90px; background: grey; } <div class="grid"> <div class="item"></div> <div class="item"></div> <div class="item"></div> <div class="item"></div> <div class="item"></div> <div class="item"></div> <div class="item"></div> <div