From e91944df91e99cd08ac2ed52e8ed24ebabe592e1 Mon Sep 17 00:00:00 2001 From: Robert Laws Date: Sun, 18 Nov 2018 06:36:38 +0300 Subject: [PATCH] add example of basic flexbox usage (#22029) --- guide/english/css/css3-flexible-box/index.md | 29 +++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/guide/english/css/css3-flexible-box/index.md b/guide/english/css/css3-flexible-box/index.md index aaf35055ac..60a38fa0fc 100644 --- a/guide/english/css/css3-flexible-box/index.md +++ b/guide/english/css/css3-flexible-box/index.md @@ -9,7 +9,34 @@ The most important idea behind the Flexbox model is that the parent container ca #### Basic usage -Flexbox can be used to center any amount of given elements inside one element. A basic example of this is the following code: +Flexbox can be used to center any amount of given elements inside one element. Given the following HTML structure: + +``` html +
+
+ This is the first container item +
+
+ This is the second container item +
+
+``` + +The following css code will apply the Flexbox model, filling the parent's container equally with its children containers and content: + +``` css +.main-container { + display: flex; +} + +.container-item { + flex: 1; +} +``` + +In this example, the parent container is utilizing the property display set to the value of flex. This will allow children of the main container to make use of the flex property. + +Another basic example of using the Flexbox model is the following code - used for the purpose of centering content within a parent container: ``` css .center-elements-inside {