SHARE
Facebook X Pinterest WhatsApp

Using Components of the Flex Layout Box Model in CSS3

Written By
thumbnail
Nathan Segal
Nathan Segal
Nov 17, 2017

The Flex Layout Box model in CSS3 is designed to accommodate different screen sizes and display devices. What makes it easier to use is the absence of floats. The children of a flex container are called flex items and are laid out using the flex layout model.

Note: not all browsers have incorporated all the Flex features.


Figure 1. This illustration shows the various directions and sizing items of the flex container.

main axis: The main axis of a flex container is where flex items are laid out. It extends in the main dimension. Note that it is the red line which extends from left to right in the flex container.

main-end: The flex items are placed within the container beginning on the main-start side and going toward the main-end side. In the illustration, you can see two flex items labeled.

main size property: The width or height of a flex container or flex item, is the main size. The main size property is its width or height property, whichever is in the main dimension. You can see the main size designation at the top of the illustration.

cross dimension: The axis perpendicular to the main axis is the cross axis. This is part of the cross dimension.

cross-end: Flex lines are filled with items and placed into the container beginning on the cross-start end of the flex container and moving toward the cross-end location, as seen on the right side of the illustration.

cross size property: The width or height of a flex container or flex item, is the cross size. Its cross-size property is thus either its width or height, whichever is in the cross dimension.


Figure2. An example of flex items.


Figure 3. A code block generated from the list items code.

What you have just read is a brief overview of how the Flex Layout Box Model works. There is much more and when you dive into the topic, you will see what this system can do.

About the Author

Nathan Segal has been working as a freelance writer for 18 years. In that time he has published more than 1,000 articles and has written 9 books. You can learn more about him at http://NathanSegal.org.

Recommended for you...

Importing Custom Less Styles at Run-time in Angular
Rob Gravelle
Jun 14, 2022
Setting CSS Values from Less Variables in Angular
Rob Gravelle
Jun 4, 2022
Color Manipulation with JavaScript
Rob Gravelle
May 21, 2022
An Introduction to CSS-in-JS
Rob Gravelle
May 14, 2022
HTML Goodies Logo

The original home of HTML tutorials. HTMLGoodies is a website dedicated to publishing tutorials that cover every aspect of being a web developer. We cover programming and web development tutorials on languages and technologies such as HTML, JavaScript, and CSS. In addition, our articles cover web frameworks like Angular and React.JS, as well as popular Content Management Systems (CMS) that include WordPress, Drupal, and Joomla. Website development platforms like Shopify, Squarespace, and Wix are also featured. Topics related to solid web design and Internet Marketing also find a home on HTMLGoodies, as we discuss UX/UI Design, Search Engine Optimization (SEO), and web dev best practices.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.