This overlay should be closed at first. We can close it by setting opacity to 0. We also need to move the modal beneath the main content by setting z-index to -1.
.modal-overlay {
opacity: 0;
z-index: -1;
}
We need a way to tell the CSS when the modal is open. The best way is to add a modal-is-open class to <body>.
<body class="modal-is-open">
We want to make the modal visible when <body> contains .modal-is-open. We can do this by setting opacity back to 1. We also need to raise it above the main content so users can interact with the modal. We do this by setting z-index to 1.
You won’t be able to close the modal by clicking outside the modal yet. You still need to learn more JavaScript to be able to do that. We’ll come back to this later in the Events module.