I have a group of controls inside a div (listbox and buttons below), and I'd like to cover them with a semi-transparent overlay (with a centered loading indicator in it).
Parent div size and position are not fixed.
Here is an example: http://jsfiddle.net/n4fbp8ex/ - Area of interest is inside red border. I'd like it to be covered with an overlay. - "Loading..." div is my overlay. It should cover whole parent div (but nothing else), and text should be centered vertically and horizontally
How do I fix my "centeredOverlay" style?
html:
<div class="halfColumn">
some content
<br/>
<input />
</div>
<div class="halfColumn">
bla bla
<br/>
lorem ipsum
<div style="border-style:solid; border-width: 1px; border-color: red;">
<div class="centeredOverlay">Loading...</div>
<select size=2 style="width:100%; height:50vh">
</select>
<button>Click me</button>
<button>Click me too</button>
</div>
</div>
<div style="clear:both"></div>
</div>
css:
.centeredOverlay {
position: absolute;
background-color: rgba(0,0,0,0.3); /*dim the background*/
}
.halfColumn {
float: left;
width: 50%;
}
.halfColumn2 {
float: right;
width: 50%;
}