Skip to content
Learn Measure Blog Case studies About
  • Home
  • All patterns
  • Layout patterns

Gentle Flex

Jun 1, 2022

A centering technique that only aligns content and doesn't change their size during the process.

See the full article for many more details about this technique and when it's efficient.

Full article · Video on YouTube · Source on Github

<article class="gentle-flex">
  <h1>Gentle Flex</h1>
</article>
.gentle-flex {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1ch;
}
Open demo
Last updated: Jun 1, 2022 — Improve article
Share
subscribe

Contribute

  • File a bug
  • View source

Related content

  • developer.chrome.com
  • Chrome updates
  • Web Fundamentals
  • Case studies
  • Podcasts
  • Shows

Connect

  • Twitter
  • YouTube
  • Google Developers
  • Chrome
  • Firebase
  • Google Cloud Platform
  • All products
  • Terms & Privacy
  • Community Guidelines

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies.