css-grid

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

淺唱寂寞╮ 提交于 2019-11-30 17:26:31
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. 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 grid and place it in a different container directly above the data. This would eliminate the grid-gap

Add scroll to each column in CSS Grid Layout

本秂侑毒 提交于 2019-11-30 14:46:23
I want separate scroll on each of my columns in my grid layout. Currently, I am developing a mobile only web application. I want to use a different grid layout for the portrait and landscape orientations. The portrait orientation is just 1 column and every element is after the other. No problem here. In the landscape orientation I want to use 2 columns. My whole content is displayed on the left side and my navigation moves to the right side. Now I want both parts to have a separate scroll. Is there a way to implement this? And the scroll should stop if the content of the current column ends.

How to make hover state on row table with CSS grid layout

老子叫甜甜 提交于 2019-11-30 11:38:19
This a table that created with CSS Grid Layout, but I have a problem with it, I can't make hover state on each row. I only want use CSS for this. Can anyone give me a solution for this? .table { display: grid; grid-template-columns: [col-start] auto [col-end]; grid-template-rows: [header-start] 50px [header-end row-start] auto [row-end]; grid-auto-rows: auto; grid-auto-columns: auto; grid-gap: 1px; } .table>* { background: gray; padding: 10px; } .heading { background: navy; color: #fff; grid-row: header; } <div class="table"> <div class="heading">Title 1</div> <div class="heading">Title 2</div

Grid with viewport height and inner scrolling div

半城伤御伤魂 提交于 2019-11-30 09:32:29
问题 I'm trying to create a layout that uses a grid that takes up the entire browser viewport ( height: 100vh ) and then allows a div within one of the grid items to scroll in the Y dimension. Here's some example code. There are three grid areas: a header across the top, a left nav, and a content area in the lower right. I'm trying to make it so div inside the content area (the big-list ), is the only thing with a vertical scrollbar, and the rest of the UI stays on the screen. body { margin: 0; }

hide elements not specified in grid-template-areas

时光总嘲笑我的痴心妄想 提交于 2019-11-30 08:25:39
问题 I'm trying to understand and work my way through the css-grid grid-template-areas option. given this html <div class="wrapper"> <div class="d">D</div> <div class="b">B</div> <div class="c">C</div> <div class="a">A</div> </div> and this css .wrapper { grid-template-areas: "areaA areaB areaC areaD" } .A { grid-area: areaA; } .B { grid-area: areaB; } .C { grid-area: areaC; } .D { grid-area: areaD; } I get the (expected) following result A B C D now if I add a media query, and wanted to hide

Items that span all columns/rows using CSS grid layout

放肆的年华 提交于 2019-11-30 08:00:30
问题 With the CSS Grid Layout Module soon shipping in Firefox and Chrome, I thought that I'd try to get a handle of how to use it. I've tried to create a simple grid with one item a spanning the left side of all of the rows, with the other items ( b , c , d , e , etc.) spanning the right side of individual rows. The amount of items spanning the right side of the rows is variable, so there might be any combination of b , c , d , e , etc., so I'm using the grid-auto-rows property. As such, I cannot

Reverse order of columns in CSS Grid Layout

巧了我就是萌 提交于 2019-11-30 07:56:11
问题 I was hoping to use CSS Grid to reverse the apparent order of two side-by-side divs, where one of the divs grows arbitrarily (I don't want to use floats). I've created a plunkr here: http://plnkr.co/edit/6WZBnHbwhD7Sjx2ovCO7?p=preview #container { grid-template-columns: 240px 1fr; display: grid; } .a { background: yellow; } .b { background: blue; color: white; } #container>.a { grid-column: 1; } #container>.b { grid-column: 2; } #container.reverse>.a { grid-column: 2; } #container.reverse>.b

How to center elements on the last row in CSS Grid?

元气小坏坏 提交于 2019-11-30 04:52:57
I am using CSS grid to layout some items like this... #container { display: grid; grid-template-columns: 16.666% 16.666% 16.666% 16.666% 16.666% 16.666%; } .item { background: teal; color: white; padding: 20px; margin: 10px; } <div id="container"> <div class="item">Item</div> <div class="item">Item</div> <div class="item">Item</div> <div class="item">Item</div> <div class="item">Item</div> <div class="item">Item</div> <div class="item">Item</div> <div class="item">Item</div> <div class="item">Item</div> <div class="item">Item</div> <div class="item">Item</div> <div class="item">Item</div> <div

Text not wrapping in CSS Grid

时光总嘲笑我的痴心妄想 提交于 2019-11-30 02:51:16
问题 I've been experimenting with CSS Grid and am stuck on finding the most effective means to have text wrap around a <div> element that is positioned partially on-top of two other <div/> elements. Basically, like in the image below, I want the text in the red and blue divs to wrap around the yellow div that has been partially positioned in the columns and rows of the other two elements. Obviously, this is a Grid based layout, so I'm not interested in doing this with typical floats. How can I use

CSS Grid wrapping?

◇◆丶佛笑我妖孽 提交于 2019-11-29 18:55:02
Is it possible to make CSS grid wrap without using media queries? In my case, I have a non-deterministic number of items that I want placed in a grid and I want that grid to wrap. Using flexbox, I'm unable to reliably space things nicely. I'd like to avoid a bunch of media queries too. Here's some sample code : .grid { display: grid; grid-gap: 10px; grid-auto-flow: column; grid-template-columns: 186px 186px 186px 186px; } .grid > * { background-color: green; height: 200px; } <div class="grid"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> </div> And here's a gif: As a side-note, if