I'm trying to create a layout that is pretty similar to the following (on large screens),
+----------------------------------+
| Header |
+-------------------------+--------+
| | |
| |Object A|
| | |
| +--------+
| | |
| Main Content | |
| |Object B|
| | |
| | |
| +--------+
| | |
| | |
+-------------------------+--------+
| Footer |
+----------------------------------+
using Bootstrap 4. I understand that Bootstrap's approach is mobile-first, and since I want the above just to stack one above the other on mobile devices, I defined it like this,
<div class="container">
<div class="row">
<div class="row mx-auto">
<h1>Header</h1>
</div>
<div class="row justify-content-end">
<!-- Object A -->
<div class="col-xs-12 order-xs-1 col-lg-5 order-lg-1 px-4 align-content-end">
</div>
<!-- Main Content -->
<div class="col-xs-12 order-xs-2 col-lg-7 order-lg-3 px-4 align-content-start flex-shrink-1">
</div>
<!-- Object B -->
<div class="col-xs-12 order-xs-3 col-lg-5 order-lg-2 px-4 align-content-end">
</div>
</div>
<!-- Footer -->
<div class="row mx-auto">
<h6>All Rights Reserved © 2020</h6>
</div>
</div>
</div>
And while on mobile devices I get the expected result, on wide screens the result is Object A
and Object B
are on top, right next to each other, and Main Content
is just under them.
tldr; I'm trying to achieve the above layout on PC while on Mobile I want it to be stacked in the following order: [Header][Object A][Main Content][Object B][Footer]
but fails to make both work on the same HTML code.