CSS Grid, outer gap

Viewed 7039

Is there a way to make an "outer grid-gap" (not just inside it) within a CSS Grid? I need to add space around my CSS grid, which is 100% height and width of the body.Like this (where green is the space/gap):

enter image description here

Here is an fiddle example of my current grid problem: https://jsfiddle.net/isakglans/4tkg8yfc/

html,body {
    width:100%;
    height:100%;
  margin:0;
}
#wrapper {
    position : relative;
    height: 100%;
    width: 100%;
}
#content {
    height: 100%;
    width: 100%;
    position : absolute;
    display: grid;
    background-color: green;
    grid-gap : 1em;
    grid-template-columns: 1fr 1fr;
}

#content div {
    background-color: blue;
}

.box1 {
    grid-column: 1;
    grid-row: 1;
}
.box2 {
    grid-column: 1;
    grid-row: 2;
}
.box3 {
    grid-column: 2;
    grid-row: 1;
}
.box4 {
    grid-column: 2;
    grid-row: 2;
}

EDIT: I don't want to have scrollbars showing up - and I don't want to do overflow:hidden to hide them.

0 Answers
Related