Create Flex Container in CSS

From the CSS Flexbox cheat sheet · Flex Container · verified Jul 2026

Create Flex Container

Transform any element into a flexible box layout container that arranges its children

css
.container {
  display: flex; /* or inline-flex */
}
html
<div class="container">
  <div class="item">1</div>
  <div class="item">2</div>
  <div class="item">3</div>
</div>
🎨 Display Flex
1
2
3
💡 Creates flex container
📦 Direct children become flex items
⚡ Enables flex properties

More CSS tasks

Back to the full CSS Flexbox cheat sheet