- Prerequisites
- Initial Setup
- Install Dependencies
- Running the Examples
- Available Commands
- Development Commands
- Running Scripts
- Troubleshooting
- Best Practices
- Extending the Application
- Documentation
- External Resources
- Last Updated
- Version
- A modern web browser (Chrome 29+, Firefox 28+, Safari 9+, Edge 12+)
- A code editor (VSCode recommended)
- Basic knowledge of HTML and CSS
- Basic understanding of HTML tags and structure
- Familiarity with CSS selectors and properties
- Willingness to experiment and learn!
- Clone the repository to your computer:
git clone https://github.com/orassayag/flexbox-learning.git
cd flexbox-learning- Open the project in your IDE (VSCode recommended)
No build process or dependencies required - this project uses pure HTML and CSS.
There are no dependencies to install! This is a pure HTML/CSS project with no npm packages or build tools needed.
-
Clone the repository to your computer:
git clone https://github.com/orassayag/flexbox-learning.git cd flexbox-learning -
Open the project in your IDE (VSCode recommended)
No build process or dependencies required - this project uses pure HTML and CSS.
If you use VSCode:
- Install the "Live Server" extension by Ritwick Dey
- Right-click on any
.htmlfile - Select "Open with Live Server"
- The page will open in your browser with auto-reload on save
Simply open any .html file directly in your web browser:
- Double-click the file in your file explorer, or
- Right-click and select "Open with" → your preferred browser
Located in project1/ directory:
Main Example (index.html):
- Demonstrates flexbox item ordering with
orderproperty - Shows how to reorder items without changing HTML structure
Example 1 (example-1/menu.html):
- Basic responsive navigation menu
- Demonstrates
flex,justify-content, and responsive behavior - Mobile-first approach with media query at 768px
Example 2 (example-2/nested-menu.html):
- Navigation with nested flexbox (social media icons)
- Shows how to combine multiple flexbox containers
- Demonstrates
flex: 1 1 0pattern
Example 3 (example-3/grid-vs-stack.html):
- Article grid layout with toggle functionality
- Switch between grid and stack layouts with jQuery
- Demonstrates
flex-wrapandflex-basiswith transitions
Located in project2/ directory:
Main Example (index.html):
- Simple flexbox container with colored boxes
- Basic starting point for flexbox experiments
- No flexbox properties applied yet (ready for practice)
display: flex; /* Creates a flex container */flex: 0 0 100px; /* flex-grow flex-shrink flex-basis */flex-grow: How much the item grows relative to othersflex-shrink: How much the item shrinks relative to othersflex-basis: The initial size before growing/shrinking
justify-content: space-between; /* Horizontal alignment */flex-wrap: wrap; /* Allow items to wrap to new lines */order: 2; /* Change display order without changing HTML */All examples work in modern browsers:
- Chrome 29+
- Firefox 28+
- Safari 9+
- Edge 12+
- Opera 17+
For older browser support, consider using vendor prefixes.
Recommended order to explore examples:
-
Start with Project 2 (
project2/index.html)- Understand the basic HTML structure
- Experiment with adding flexbox properties in
style.css
-
Project 1 Main (
project1/index.html)- Learn about the
orderproperty - See how flex items can be reordered
- Learn about the
-
Example 1 (
project1/example-1/menu.html)- Build a responsive navigation menu
- Understand mobile-first responsive design
-
Example 2 (
project1/example-2/nested-menu.html)- Combine multiple flex containers
- Create complex layouts with nested flexbox
-
Example 3 (
project1/example-3/grid-vs-stack.html)- Build dynamic layouts
- Use flex-wrap for grid systems
- Apply transitions to flex properties
Feel free to modify any CSS file to experiment:
- Change
justify-contentvalues (flex-start, flex-end, center, space-around) - Modify
flexproperties to see how items grow/shrink - Add
align-itemsfor vertical alignment - Try
flex-direction: columnfor vertical layouts
Most examples use a mobile-first approach:
@media screen and (min-width: 768px) {
/* Desktop styles here */
}Test responsive behavior by resizing your browser window or using browser DevTools device mode.
- CSS-Tricks: A Complete Guide to Flexbox
- MDN: Flexbox
- Flexbox Froggy - Interactive game to learn flexbox
Since this is a pure HTML/CSS project, there are no commands to run! Just open the HTML files in your browser.
There are no development commands required! This project doesn't use any build tools or package managers.
There are no scripts to run! To view the examples:
- Open any
.htmlfile directly in your browser - Or use VSCode's Live Server extension for auto-reload
Problem: Layout looks broken in your browser Solutions:
- Make sure you're using a modern browser (Chrome 29+, Firefox 28+, Safari 9+, Edge 12+)
- Check browser compatibility section for supported versions
- Use browser dev tools to inspect elements and see what's wrong
Problem: You modified CSS but don't see changes in browser Solutions:
- Hard refresh your browser (Ctrl+Shift+R or Cmd+Shift+R)
- Make sure you're editing the correct CSS file
- If using Live Server, check that it's running and connected
Problem: Layout doesn't work on mobile/desktop Solutions:
- Check media query breakpoints in CSS
- Use browser dev tools device mode to test responsive behavior
- Verify you're using a mobile-first approach
- Use
flexshorthand: Preferflex: 1 1 0over individual properties for consistency - Mobile-first design: Start with mobile styles, then add media queries for larger screens
- Comment your code: Explain what each flex property does for clarity
- Test responsiveness: Resize your browser to ensure layouts work on all screen sizes
- Use semantic HTML: Ensure your markup is accessible and meaningful
- Start simple: Begin with
project2/index.htmlto understand basics - Make small changes: Modify one property at a time to see its effect
- Inspect elements: Use browser dev tools to experiment with flex properties live
- Read comments: Examples include detailed explanations in comments
- Practice: Try recreating layouts from scratch to reinforce learning
- Create a new HTML file (e.g.,
my-example.html) - Create a corresponding CSS file if needed
- Link your CSS file in the HTML
- Experiment with flex properties!
- Consider adding comments to explain your code
You can organize new examples in:
project1/for advanced flexbox examplesproject2/for basic flexbox examples- Or create a new directory for your own examples!
- README.md - Project overview and features
- CONTRIBUTING.md - How to contribute
- CHANGELOG.md - Version history
- CODE_OF_CONDUCT.md - Community guidelines
- CSS-Tricks: A Complete Guide to Flexbox
- MDN Web Docs: Flexbox
- Flexbox Froggy - Interactive learning game
- Flexbox Defense - Another interactive game
- Can I Use: CSS Flexible Box Layout - Browser compatibility info
- Or Assayag - Initial work - orassayag
- Or Assayag orassayag@gmail.com
- GitHub: https://github.com/orassayag
- StackOverflow: https://stackoverflow.com/users/4442606/or-assayag?tab=profile
- LinkedIn: https://linkedin.com/in/orassayag
June 2026
1.0.0