Files
30-seconds-of-code/snippets/flexbox-centering.md
Isabelle Viktoria Maciohsek c5d68af0b5 Make expertise a field
2022-03-01 20:22:55 +02:00

613 B

title, tags, expertise, firstSeen, lastUpdated
title tags expertise firstSeen lastUpdated
Flexbox centering layout beginner 2018-03-03T11:57:27+02:00 2020-12-30T15:37:37+02:00

Horizontally and vertically centers a child element within a parent element using flexbox.

  • Use display: flex to create a flexbox layout.
  • Use justify-content: center to center the child horizontally.
  • Use align-items: center to center the child vertically.
<div class="flexbox-centering">
  <div>Centered content.</div>
</div>
.flexbox-centering {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100px;
}