Skip to content

Flexbox & Grid Layout ​

This page sums up where and why Flexbox and Grid were each used in the portfolio project, along with a few other CSS design points.

Where Flexbox Was Used ​

AreaReason
.navbarPlaces logo – menu – button left to right on one line (justify-content: space-between)
.nav-linksLines up menu items side by side horizontally
.hero__actionsCenters 2 buttons and allows wrapping (flex-wrap)
.project-card__metaLists language/star/fork info on one line, pinned to the bottom of the card with margin-top: auto
.filter-groupLines up filter buttons horizontally and allows wrapping
.footer-contentPlaces the copyright text and links on the left and right

Flexbox was used everywhere that only needed alignment in one direction (horizontal or vertical).

Where Grid Was Used ​

AreaReason
.section-grid (About, Contact)Clearly splits the text area and the image/form area into two columns, left and right
.skills-gridPlaces skill cards with repeat(auto-fit, minmax(240px, 1fr)) so the number of columns adjusts automatically to the screen width
.projects-gridSince the number of GitHub API results varies, an auto-fit grid that wraps automatically regardless of the number of cards is a good fit

Grid was chosen wherever multiple cards had to be listed responsively or the screen had to be split into two large areas.

Other Design Points ​

  • A shared transition was applied to buttons and cards so the translateY and shadow changes on hover appear smoothly.
  • .reveal / .reveal.is-visible live in utilities.css so they are not tied to a particular section and can be reused on any element.

Summary ​

TypeSelection criteriaWhere it was used
FlexboxWhen only one-direction (horizontal or vertical) alignment is needed.navbar, .nav-links, .hero__actions, .project-card__meta, .filter-group, .footer-content
GridWhen listing cards responsively or splitting the screen into two large areas.section-grid, .skills-grid, .projects-grid
OtherHover effects with a shared transition, .reveal reused from utilities.cssButtons and cards, scroll-reveal elements

Source: Codyssey-B1/B1-1