div.layer { display: block; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.46); } div.layer > div { top: 156px; left: 248px; width: 345px; height: 256px; display: block; position: fixed; background-color: rgba(255, 255, 255, 0.54); } <div class="layer"> <div></div> </div> As you can see the container is stretched across the whole page and it is a bit transparent black. It is necessary to ensure that the child element is completely transparent regardless of what color div.layer.
That is, the color of the child element is considered to be from the color of the parent => it is impossible to make it completely transparent. How to solve this problem?
Using JavaScript is allowed. But to draw dark stripes on the left, on the right, on the bottom and on top, so that an “unpainted” piece remains in the middle - no.
