css-grid

force css grid container to fill full screen of device

痞子三分冷 提交于 2019-12-03 04:53:59
问题 How do I force a css grid container take the full width and height of the device screen for a single page app? Modified example is from Mozilla: Firefox documentation .wrapper { display: grid; border-style: solid; border-color: red; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); grid-gap: 10px; } .one { border-style: solid; border-color: blue; grid-column: 1 / 3; grid-row: 1; } .two { border-style: solid; border-color: yellow; grid-column: 2 / 4; grid-row: 1 / 3; }

How do I specify row heights in CSS Grid layout?

丶灬走出姿态 提交于 2019-12-03 03:40:05
问题 I have a CSS Grid Layout in which I want to make some (middle 3) rows stretch to their maximum size. I'm probably looking for a property similar to what flex-grow: 1 does with Flexbox but I can't seem to find a solution. Note: This is intended for an Electron app only, so browser compatibility is not really a concern. I have the following CSS Grid Layout: .grid { display: grid; grid-template-columns: 1fr 1.5fr 1fr; grid-gap: 10px; height: calc(100vh - 10px); } .grid .box { background-color:

How do I specify row heights in CSS Grid layout?

霸气de小男生 提交于 2019-12-02 18:34:06
I have a CSS Grid Layout in which I want to make some (middle 3) rows stretch to their maximum size. I'm probably looking for a property similar to what flex-grow: 1 does with Flexbox but I can't seem to find a solution. Note: This is intended for an Electron app only, so browser compatibility is not really a concern. I have the following CSS Grid Layout: .grid { display: grid; grid-template-columns: 1fr 1.5fr 1fr; grid-gap: 10px; height: calc(100vh - 10px); } .grid .box { background-color: grey; } .grid .box:first-child, .grid .box:last-child { grid-column-start: 1; grid-column-end: -1; } /*

Reduce space between rows in CSS Grid

拟墨画扇 提交于 2019-12-02 16:35:08
问题 I'm wondering how to reduce the spacing between the rows? I've tried setting margins and paddings to 0, but nothing seems to be biting. Destktop view on the left and mobile view on the right. .content{ margin: 0; padding: 0; width: 100%; display: grid; grid-gap: 5px; grid-template-columns: repeat(36, 1fr); justify-items: stretch; align-content: start; } .one{ grid-column: 1/37; width: 100%; } .two{ grid-column: 1/11; } .three{ grid-column: 12/24; justify-self: center; align-self: start;

A css-grid that needs to center on page - how? [duplicate]

喜夏-厌秋 提交于 2019-12-02 14:09:10
This question already has an answer here: How to horizontally center a <div>? 101 answers How to vertically center a div for all browsers? 44 answers I am building a school project, were supposed to build a board game, so far I've made the actual board with the help of a grid and a few lines of js. Now I thought I was doing the easy part of centering the container div to its container the browser, but oh my no way! So far have none of the normal ways have done what I want... so now I turn here. Most important is to center it horizontal... secondly verticaly. Heres the code so far: function

CSS Grid not working in ie11 despite prefixes

早过忘川 提交于 2019-12-02 13:38:40
I have the following simple layout example using CSS grid .container { width: 100%; display: -ms-grid; display: grid; -ms-grid-columns: 1fr auto 1fr; grid-template-columns: 1fr auto 1fr; } .item1 { text-align:center; background:red; color:white; padding:20px } .item2 { text-align:center; background:green; color:white; padding:20px } .item3 { text-align:center; background:blue; color:white; padding:20px } <div class="container"> <div class="item1"> Item 1 </div> <div class="item2"> Item 2 </div> <div class="item3"> Item 3 </div> </div> I have prefixed with ie specific prefixes but the grid is

Reduce space between rows in CSS Grid

≯℡__Kan透↙ 提交于 2019-12-02 13:23:22
I'm wondering how to reduce the spacing between the rows? I've tried setting margins and paddings to 0, but nothing seems to be biting. Destktop view on the left and mobile view on the right. .content{ margin: 0; padding: 0; width: 100%; display: grid; grid-gap: 5px; grid-template-columns: repeat(36, 1fr); justify-items: stretch; align-content: start; } .one{ grid-column: 1/37; width: 100%; } .two{ grid-column: 1/11; } .three{ grid-column: 12/24; justify-self: center; align-self: start; position: relative; bottom: 5px; } .four{ grid-column: 25/37; } Here's a link to a test site: http://www.acm

Remove empty space in CSS Grid

会有一股神秘感。 提交于 2019-12-02 11:33:39
问题 I have the following layout: .grid { display: grid; grid-template-columns: 645px 316px; grid-gap: 20px; } .top { grid-column: 1 / 2; grid-row: 1; background-color: green; } .right { grid-column: 2; grid-row: 1 / span 2; background-color: blue; } .bottom { grid-column: 1; grid-row: 2; background-color: red; } <div class="grid"> <div class="top">top</div> <div class="right"> a <br> a <br> a <br> a <br> a <br> a <br> a <br> a <br> a <br> a <br> </div> <div class="bottom"> bottom </div> </div>

How to make CSS Grid last row to take up remaining space

拟墨画扇 提交于 2019-12-02 10:22:39
I have a grid with variable number of rows and I want the last one to be 1fr height. Something like this: Is there any way of doing that? you could use flex for this. Te parent container should have display: flex; . We want to use it vertically, so we will change the flex direction like this flex-direction: column; . After this, we will use the property flex-shrink: 1; for every child. This way, it will take only the space needed/specified. The tricks for the last child is to use the property flex-grow: 1; so it will take the available space. See the snippet below: html, body { height: 100%; }

Trying to add an image inside a CSS Grid

安稳与你 提交于 2019-12-02 09:48:02
How would I be able to put an image inside a CSS Grid? This is all I'm trying to do and can't figure it out. This was my attempt at a CSS Grid: https://jsfiddle.net/g6oaht8f/72/ But it didn’t work as I had expected it would. The grid isn’t viewable over the image here. If the grid was viewable the lines would be Red . Full Code: https://jsfiddle.net/g6oaht8f/73/ .wrap { position: relative; width: 600px; height: 600px; margin-top: 45px; overflow: hidden; border-radius: 25px; background: url("https://i.imgur.com/1TbGgqz.png") no-repeat 0 -600px; } .wrap svg:hover path { fill: #0059dd; } .wrap