Code Studio: Flexbox Header and Grid Cards
Lay out a portfolio page the way Flex, Grid, and CSS Layout Techniques describes: Flexbox for the header and navigation, Grid for the content. The page is loaded; you write the layout in the stylesheet.
- Make the
headera flex container withdisplay: flex, then usejustify-content: space-betweenandalign-items: centerso your name sits on the left and the links on the right. - Style the navigation links (
nav a) so they are white with some space between them. - Make
.projectsa grid with three equal columns:display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;. - Give each
.projectcard a border, padding and rounded corners. - Make it responsive: add a
@media (max-width: 600px)rule that changes the grid to one column. Narrow the preview by resizing your browser window to see it switch.
Think about it: why is Flexbox the right tool for the header but Grid the right tool for the cards?
Lay out a portfolio page the way Flex, Grid, and CSS Layout Techniques describes: Flexbox for the header and navigation, Grid for the content. The page is loaded; you write the layout in the stylesheet.
- Make the
headera flex container withdisplay: flex, then usejustify-content: space-betweenandalign-items: centerso your name sits on the left and the links on the right. - Style the navigation links (
nav a) so they are white with some space between them. - Make
.projectsa grid with three equal columns:display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;. - Give each
.projectcard a border, padding and rounded corners. - Make it responsive: add a
@media (max-width: 600px)rule that changes the grid to one column. Narrow the preview by resizing your browser window to see it switch.
Think about it: why is Flexbox the right tool for the header but Grid the right tool for the cards?