Displayed below is the navbar code snippet:
<div class="d-flex flex-column flex-lg-row">
......
</div>
As shown in the example:
.bd-highlight {
background-color: rgba(86,61,124,.15);
border: 1px solid rgba(86,61,124,.15);
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="d-flex flex-column flex-lg-row justify-content-between bd-highlight">
<div class="p-2 bd-highlight order-0">Flex item 1 (LOGO)</div>
<div class="p-2 bd-highlight order-2 order-lg-1">Flex item 2 (Nav. Menu)</div>
<div class="p-2 bd-highlight order-1 order-lg-2">Flex item 3 (Search Form)</div>
<div class="p-2 bd-highlight order-3">Flex item 4 (Acc. Menu)</div>
</div>
The design requirements also include specific cases described below:
1- Media device ( ≥ 992px ): all displayed side by side.
https://i.sstatic.net/TOby5.png
2- Media device ( < 992px ): all displayed underneath. However, Flex item 2
and Flex item 3
are repositioned using the order-*
class. -Refer to the snippet and image above.- Following that, the goal is to align Flex item 1 - Flex item 3
and Flex item 2 - Flex item 4
side by side in rows.
https://i.sstatic.net/Cuzht.png
While everything else is functioning as intended, achieving the alignment of Flex item 1 - Flex item 3
and Flex item 2 - Flex item 4
side by side specifically through self-alignment proves to be a challenge due to the parent container being in a column layout and the inability to add additional parent elements without affecting their positioning.
AS SHOWN BELOW:
https://i.sstatic.net/eKxEL.png
Does Bootstrap 4 or flexbox provide support for this alignment requirement? Is it feasible within these frameworks, or should alternative solutions be explored?
For instance:
<div class="flex-column">
<div class="flex-self-row1"></div>
<div class="flex-self-row1"></div>
<div class="flex-self-row2"></div>
<div class="flex-self-row2"></div>
</div>