Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialgene c
13,630 PointsWhy do I have extra unwanted space at all 4 sides of my layout when I use CSS Grid?
This is my code:
* {
box-sizing: border-box;
}
.container {
height: 100vh;
display: grid;
grid-template-columns: 1fr 2fr 2fr 1fr;
grid-template-rows: 50px minmax(200px, 1fr) 100px;
grid-template-areas:
"header header header header"
". main form ."
"footer footer footer footer";
header {
grid-area: header;
background-color: blue;
}
main {
grid-area: main;
background-color: tomato;
}
form {
grid-area: form;
background-color: purple;
}
footer {
grid-area: footer;
background-color: green;
}
}
1 Answer
Steven Parker
231,248 PointsTry adding this to your CSS, to turn off the default body
element margins:
body { margin: 0; }
gene c
13,630 Pointsgene c
13,630 PointsI did some research and it could be because normal browsers leave an 8px margin all around the content. One solution could be using normalise.css am I right?
Appreciate if someone can see if I'm right and suggest other solutions! :)