I am currently in the process of developing a loading image that will overlay a page when a call is initiated.
My tools for this project include handlebars, HTML, CSS, and JavaScript.
In my .hbs file, the structure resembles the following:
<div id="spinner"></div>
<div class="special-container"></div>
<div class="special-container"></div>
The JavaScript code populates the spinner and special containers with content. For demonstration purposes, let's refer to them as "spinner" and "special-container".
Within the spinner div, the following content is inserted:
<div id="mask">
<div id="spinner">
Hello world I am the spinner page
<span class="icon icon-house margin-right-10" ></span>
</div>
</div>
My CSS styling is stored in a .less file structured like this:
.special-container {
max-width: 1170px;
position:absolute;
}
#spinner {
position: relative;
z-index: 100;
}
Upon rendering the page with the initial code, the spinner appears above the two special containers which are stacked on top of each other. However, adjusting the CSS results in either the spinner being displayed incorrectly or the special containers overlapping each other.
The goal is to have the spinner centered on the page and responsive to resizing without sacrificing the stacking order of the elements. Despite referencing solutions online, such as positioning recommendations, the issue remains unresolved.
Positioning Without Styling: Spinner Div2 Div3
Positioning With Styling: Spinner/Div2/Div3 (Spinner on top)
The challenge lies in understanding why applying positioning causes the layout to distort and how to rectify this behavior.
What impact does positioning have on the design? How can this be addressed without compromising the desired display?