Experiencing an issue with high CLS (Content Layout Shift) using Bootstrap (4.5) grid for a two-column layout with column order change.
CLS is a crucial Core Web Vital metric that Google monitors to ensure webpage elements do not shift during loading, potentially impacting SEO rankings.
My layout features two columns on higher resolutions - main content on the right and sidebar on the left. However, on smaller screens, the sidebar content is pushed down below the main content.
<div class="container-fluid">
<div class="row">
<div class="col-lg-8 order-lg-2">
</div>
<div class="col-lg-4 order-lg-1">
</div>
</div>
</div>
The issue arises when, upon page render on desktops, the main content momentarily appears on the left side before shifting to its correct position on the right. This shift is subtle on simple pages but becomes noticeable with more complex layouts or external resources.
For reference, here's an example page I've prepared. To evaluate CLS, I use Chrome Lighthouse, which indicates a value of 0.326 for the shifting columns. Results may vary depending on rendering resources, but Google Page Insight typically offers similar findings:
https://i.sstatic.net/OowJx.png
Is there a way to prevent this shift during page load?