AssignmentFB001

Flexbox Parent - Flex Direction Row

We have two options for layout design, Grid and Flexbox. We can use either technology for layout design, each has its pros and cons. I recommend Grid for complex designs and Flexbox for simple designs (also components like menus and buttons). You can also use them both on the same layout.

In the following assignments, we are going to explore Flexbox in depth. Although, I will be using divs for our examples, Flexbox can easily be applied to lists and, as previously mentioned, buttons. Let us look at Flexbox direction row.

flex-direction, justify-content, and align-items

Flexbox requires a parent container and children elements. The following elements are all divs. The light blue elements are the parent elements (containers). The coral elements are children (elements within the parent).

The parent container must be given the rule display:flex in order to enable Flexbox. You can then specify the flex-direction, row or column. If you leave out flex-direction, the default is row. Flex children will then line up in a row (next to each other).

Remember this - If flex-direction is row:

In order to get credit, create three parent divs (50% x 500px ) and three children divs (100px x 100px ) within each parent. Set the parent div to display:flex. Also, change the property values below to any of the suggested property values. Please label your work and let me know which property values you applied.

Rows

.parent001

flex-direction:row

(Try row or row-reverse)

Item1
Item2
Item3

.parent002

justify-content:space-around

(Try space-around, center, flex-start, flex-end, space-evenly, or space-between)

Item4
Item5
Item6

.parent003

align-items:flex-end

(Try flex-end, center, or flex-start. Avoid baseline)

Item 7
Item 8
Item 9