Skip to content

orassayag/flexbox-plays

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Flexbox Plays

A collection of CSS Flexbox examples and demonstrations for learning and experimenting with modern CSS layout techniques.

Built in November 2018. This project provides hands-on examples of CSS Flexbox properties and patterns, including responsive navigation menus, nested flex containers, and interactive layout toggles.

Features

  • πŸ“¦ Basic flexbox ordering and alignment examples
  • πŸ“± Responsive navigation menu with mobile-first approach
  • πŸ”— Nested flexbox containers with multiple menus
  • πŸŽ›οΈ Interactive grid vs stack layout toggle
  • πŸ’‘ Clean, well-commented code for learning
  • 🌐 No build process - pure HTML/CSS
  • βœ… Cross-browser compatible (modern browsers)

Getting Started

Prerequisites

  • A modern web browser (Chrome, Firefox, Safari, or Edge)
  • No dependencies or build tools required

Installation

  1. Clone the repository:
git clone https://github.com/orassayag/flexbox-plays.git
cd flexbox-plays
  1. Open any HTML file in your browser:
# Open main example
open index.html
# or
open example-1/menu.html

No installation, build, or compilation needed - just open and explore!

Examples

Main Example - Flexbox Ordering

File: index.html

Demonstrates basic flexbox ordering with numbered blocks that display in a custom order using the order property.

β”Œβ”€β”€β”€β”¬β”€β”€β”€β”¬β”€β”€β”€β”¬β”€β”€β”€β”
β”‚ 2 β”‚ 1 β”‚ 4 β”‚ 3 β”‚
β””β”€β”€β”€β”΄β”€β”€β”€β”΄β”€β”€β”€β”΄β”€β”€β”€β”˜

Key Concepts:

  • display: flex
  • order property
  • justify-content: space-between
  • Fixed flex basis

Example 1 - Responsive Menu

File: example-1/menu.html

A responsive navigation menu that stacks vertically on mobile and displays horizontally on desktop.

Mobile:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Home   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  About  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Store  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Contact β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Desktop (β‰₯768px):

β”Œβ”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Home β”‚ Aboutβ”‚ Storeβ”‚ Contact β”‚
β””β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Concepts:

  • Media queries
  • Mobile-first responsive design
  • Equal width flex items
  • Hover effects

Example 2 - Nested Menu

File: example-2/nested-menu.html

Navigation with main menu and social media links using nested flex containers.

β”Œβ”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Home β”‚ Aboutβ”‚ Storeβ”‚ Contact β”‚ Facebook β”‚ Twitter β”‚
β””β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Concepts:

  • Nested flexbox containers
  • Multiple flex rows
  • space-between alignment
  • Responsive social links

Example 3 - Grid vs Stack Toggle

File: example-3/grid-vs-stack.html

Interactive example with a toggle button to switch between grid and stacked article layouts.

Grid Layout:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚Article 1β”‚Article 2β”‚Article 3β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚Article 4β”‚Article 5β”‚Article 6β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Stack Layout:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         Article 1             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚         Article 2             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚         Article 3             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Concepts:

  • flex-wrap: wrap
  • Dynamic class toggling
  • Article grid layout
  • jQuery integration
  • Flexible article cards

Architecture

graph TD
    A[Flexbox Plays Project] --> B[Main Example]
    A --> C[Example 1: Menu]
    A --> D[Example 2: Nested Menu]
    A --> E[Example 3: Grid vs Stack]
    
    B --> B1[index.html]
    B --> B2[style.css]
    
    C --> C1[example-1/menu.html]
    C --> C2[example-1/style.css]
    
    D --> D1[example-2/nested-menu.html]
    D --> D2[example-2/style.css]
    
    E --> E1[example-3/grid-vs-stack.html]
    E --> E2[example-3/style.css]
    E --> E3[jQuery Integration]
    
    B1 --> F[Flexbox Concepts]
    C1 --> F
    D1 --> F
    E1 --> F
    
    F --> F1[display: flex]
    F --> F2[justify-content]
    F --> F3[align-items]
    F --> F4[flex-wrap]
    F --> F5[order]
    F --> F6[flex basis/grow/shrink]
Loading

Project Structure

flexbox-plays/
β”œβ”€β”€ index.html              # Basic flexbox ordering
β”œβ”€β”€ style.css               # Main example styles
β”œβ”€β”€ example-1/              # Responsive menu
β”‚   β”œβ”€β”€ menu.html
β”‚   └── style.css
β”œβ”€β”€ example-2/              # Nested menu
β”‚   β”œβ”€β”€ nested-menu.html
β”‚   └── style.css
β”œβ”€β”€ example-3/              # Grid vs Stack
β”‚   β”œβ”€β”€ grid-vs-stack.html
β”‚   └── style.css
β”œβ”€β”€ README.md               # This file
β”œβ”€β”€ CONTRIBUTING.md         # Contribution guidelines
β”œβ”€β”€ INSTRUCTIONS.md         # Detailed usage instructions
└── LICENSE                 # MIT license

Flexbox Properties Reference

Container Properties

Property Description Values
display Defines flex container flex, inline-flex
flex-direction Main axis direction row, column, row-reverse, column-reverse
justify-content Main axis alignment flex-start, flex-end, center, space-between, space-around
align-items Cross axis alignment flex-start, flex-end, center, stretch, baseline
flex-wrap Item wrapping nowrap, wrap, wrap-reverse

Item Properties

Property Description Values
flex Shorthand for grow/shrink/basis <grow> <shrink> <basis>
order Display order <integer>
align-self Individual cross axis alignment auto, flex-start, flex-end, center, baseline, stretch

Browser Support

  • βœ… Chrome (29+)
  • βœ… Firefox (28+)
  • βœ… Safari (9+)
  • βœ… Edge (12+)
  • ⚠️ IE 11 (with prefixes)

Learning Resources

Contributing

Contributions to this project are released to the public under the project's open source license.

Everyone is welcome to contribute. Contributing doesn't just mean submitting pull requestsβ€”there are many different ways to get involved, including answering questions and reporting issues.

Please see CONTRIBUTING.md for detailed contribution guidelines.

Author

License

This application has an MIT license - see the LICENSE file for details.

About

A collection of CSS Flexbox examples and demonstrations for learning and experimenting with modern CSS layout techniques. Built in November 2018. This project provides hands-on examples of CSS Flexbox properties and patterns, including responsive navigation menus, nested flex containers, and interactive layout toggles.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors