I am trying to create a very simple modal in CSS and would like to use a single DOM element for the vignette and the main content. So far, I:
<div class="modal"></div>
.modal { position: fixed; top: 20%; left: 50%; right: 50%; width: 620px; margin: 0 -320px; height: 540px; background: $white; z-index: 4000; } .modal:before { content: ""; position: fixed; top: 0; left: 0; bottom: 0; right: 0; width: 100%; height: 100%; background: $black; z-index: 2000 }
Unfortunately, this leads to the fact that the vignette is displayed on top of the modal (not behind it). How can it be forcibly reduced without creating a new div for it?
source share