Hackforge Academy

Category: html_css

css Flexbox

Published on 29 Jun 2026

Explanation

Flexbox is a one-dimensional layout system that makes it easy to align and distribute elements horizontally or vertically.

Code:

.container {
  display: flex;
}

Explanation

The justify-content property controls horizontal alignment of flex items inside the container.

Code:

.container {
  display: flex;
  justify-content: space-between;
}

Explanation

The align-items property controls vertical alignment of flex items along the cross axis.

Code:

.container {
  display: flex;
  align-items: center;
  height: 200px;
}

Explanation

The flex-direction property changes the direction of flex items from row to column or vice versa.

Code:

.container {
  display: flex;
  flex-direction: column;
}

Explanation

The gap property adds consistent spacing between flex items without using margins.

Code:

.container {
  display: flex;
  gap: 20px;
}

๐Ÿš€ Learn Spring Boot with real-world projects

๐Ÿ’ก Build REST APIs step by step

๐Ÿง  Improve backend development skills

๐ŸŽฏ Get career-ready practical training

Join Our Free WhatsApp Community

Direct access to niche-specific mentors and peers on WhatsApp.

๐Ÿ

Python Community

Discuss Django, FastAPI, AI integration, and automation scripts with 15k+ developers.

Join Python Community
โš›๏ธ

React Community

Master Next.js, Framer Motion, and State Management. Share your latest UI components.

Join React Community
โ˜•

Java Community

Deep dives into Spring Boot, Microservices architecture, and high-performance backend ops.

Join Java Community