css-grid

Flexbox, strange behaviour with CSSGrid

帅比萌擦擦* 提交于 2019-12-04 05:11:44
问题 I have this situation: https://jsfiddle.net/johnsam/rdtva2fq/ On Chrome it works good, see this: It start (see "FIRST" and "LAST" btn). Good. On Safari it doesn't (also with iPad/iPhone, it's the same) see this: "FIRST" btn OK, "LAST" one nope. The page has a scrollbar that is what I don't want! If I remove the header part it works good, so my guess is Safari doesn't recognize the ( height: 100vh MINUS the header part of that height) maybe. I'm right? Code: <div class="my-all d-flex flex

How to specify the maximum number of columns repeat() will create using auto-fit/fill?

狂风中的少年 提交于 2019-12-04 04:53:53
Is there a way, without using media query , to limit the number of columns that get created, and combine that with auto-fit/fill? For example: grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); Creates a wonderful, responsive layout. But imagine the design calls for a maximum of 3 columns -- even in wide browsers. It would happily show, 4, 5, more columns as space allows. Using media query, I could specify big screens get: grid-template-columns: 1fr 1fr 1fr; And smaller screens get: grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); But that feels wrong. Is there a way to

animating a smooth css grid-column change

喜欢而已 提交于 2019-12-04 04:11:27
问题 I am using CSS grid layout to position various parts on a website. I use grid-column: x / x; and grid-row x / x; to set their position and size on the page. It's working really well. Now I am trying to animate a smooth transition between two grid-column fixes which happens when the screen size changes. The change is from grid-column: 3 / 9; to grid-column: 2 / 10; which means the div grows on either side by 1fr each. At the moment it just "pings" into place but I would like to have a smooth

Placing the footer out of view using CSS grid

折月煮酒 提交于 2019-12-04 04:03:41
问题 I have a header that is 70px high, the main content which I want to fill the rest of the screen and then a 70px footer. I am trying to find the most simple approach of hiding a footer. This works with the footer in view - see jsfiddle and snippet below: * { margin: 0; padding: 0; } *, *::before, *::after { box-sizing: border-box; } body { display: grid; margin: 0px; grid-gap: 10px; height: 100vh; grid-template-columns: [side__nav] 250px [main] 1fr; grid-template-rows: [header] 70px auto

Can grid-row-gap / grip-column-gap be overridden for a single gutter?

佐手、 提交于 2019-12-03 20:39:00
问题 Is there a way to set a single grid-row-gap to specific size that is different from the rest of the grid? Use case: the top row of the grid should have less of a gap to the second row than the rest of the grid as it acts as a header. 回答1: The grid-row-gap and grid-column-gap properties apply to the entire grid (spec reference). However, you can use negative margins on the second row grid items to adjust their position. Another option would be to remove the top row (headers) from the current

CSS Grid Layout in Chrome seems not to work properly with more than 1000 rows

混江龙づ霸主 提交于 2019-12-03 17:44:09
问题 I have created an example of a sliding grid with fixed headers, using the "CSS Grid Layout" and "sticky position" technologies. For convenience, the content of the grid is generated by a script, which I think works well. function fillGrid(selector, rows) { let cols = 3; let grid = $(selector); grid.empty(); //cr header grid.append($('<div>').addClass('hcr').text('#')); //col headers for (let c = 1; c <= cols; c++) { grid.append($('<div>').addClass('hc').text(`Column ${c}`)); } for (let r = 1;

Flexbox: flex-start, self-start, and start; What's the difference?

别说谁变了你拦得住时间么 提交于 2019-12-03 11:14:26
I just noticed some values of the align-self property that I haven't seen before. What are start , end , self-start , and self-end and what are their differences from flex-start and flex-end ? I've been referring to the guide at CSS-Tricks often when I work with flexbox, but it doesn't mention these values. I read the documentation for align-self at MDN, but the one-line description of the values isn't enough for me to understand. I thought I might be able to play around with the values to figure it out, but they all seem to do the same thing... .container { display: flex; justify-content:

Collapsing borders using CSS Grid

﹥>﹥吖頭↗ 提交于 2019-12-03 09:44:15
I'm having fun getting my head around the new CSS Grid spec, but I'm running into trouble with borders. Is it possible to collapse borders in a CSS Grid, or is there any way to style the gutter? As you can see in the snippet below, the 10px borders stack ( 20px total) in-between blocks. I understand this issue isn't unique to CSS Grids, but I'm hoping it'll allow for new solutions for creating a uniform 10px border between all boxes and on the outer edges. My actual use-case is a calendar I'm making to practice working with Grids and React components. You can see the issue I'm running into

Why auto-fit or auto-fill not working properly with minmax?

别说谁变了你拦得住时间么 提交于 2019-12-03 08:25:31
It doesn't work properly when I add auto-fit or auto-fill instead of a number. grid-template-columns: repeat(auto-fit, minmax(max-content, max-content)); But it works properly when I add number instead of max-content. grid-template-columns: repeat(auto-fit, minmax(50px, max-content)); But I want the size of the grid to be the same(be fit) as the size of the content. Like this: grid-template-columns: repeat(30, minmax(max-content, max-content)); (using auto-fit or auto-fill). How can I do that? * { margin: 0; padding: 0; box-sizing: border-box; } ul { display: grid; grid-template-columns:

Making a dragbar to resize divs inside CSS grids

淺唱寂寞╮ 提交于 2019-12-03 06:30:49
问题 I have 2 boxes and a vertical div line in one unique container div (code and fiddle below). I'm using CSS grids to position my elements inside the container What I'd like to accomplish is to use the vertical line to resize horizontally the two boxes based on the position of the vertical line. I apologize if the question is noobish, I am new to web development, only used Python before, already tried to google and stackoverflow search but all solutions seem overly complicated and generally