ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Flexbox control
  • Overview
  • How to?
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Flexbox example: automatic control layout
Overview
Flexbox controls allow arranging controls exactly as desired when the browser is resized.
Here is a configuration example.
A page contains 5 cells with images and text. These 5 cells are in a Flexbox control.
With the Flexbox control, when the browser is resized horizontally, the 5 cells are automatically positioned according to 3 rules:
  • cells must be laid out on one or more rows depending on the available width,
  • all cells must remain justified,
  • cells must remain the same size.
Remark: This page is based on the "WW_Flexbox" example.
How to?
To rearrange the cells according to the size of the browser:
  1. Place the Cell controls in a Flexbox control: 3 cells on the first row and 2 cells on the second.
  2. Open the Flexbox control description. The options to be modified are in the "Details" tab of the description window.
    Each rule to be applied corresponds to an option:
    • when the width of the browser is reduced, cells move to the next row:
      To apply this rule, go to "Line wrap (flex-wrap)" and choose "wrap".
    • cells must occupy all the available width and be evenly spaced: To apply this rule, go to "Horizontal alignment (justify-content)" and choose "space-around".
    • cells must remain the same size: To apply this rule, the "Vertical alignment on each row (align-items)" value is set to "flex-start".
To obtain a clean interface, the spacing between rows and columns is set to 20 pixels.
The anchoring options of the Flexbox control are set in a way so that it occupies all the available horizontal space and adapts vertically to fit its content.
Here is the result at runtime:
  • Maximized browser:
  • Reduced browser:
Related Examples:
WW_Flexbox Training (WEBDEV): WW_Flexbox
[ + ] This example presents the Flexbox control, which determines the positioning of the controls it contains.
Minimum version required
  • Version 28
Comments
Click [Add] to post a comment

Last update: 06/28/2023

Send a report | Local help