Capstone: A Modal Overlay
Combine fixed, absolute, and z-index to build a modal that hovers above the page with a dark backdrop and a centred dialog box.
Step 1 of 3
The brief
You are building the visual structure of a modal — the kind that opens when you click 'Delete account' or 'Confirm order'.
Requirements:
- A full-viewport translucent black backdrop (
position: fixed, edges at 0). - A white dialog centred on the screen — use
position: fixedand atransformtrick, or settop/leftwith negative offsets. - A close button positioned in the top-right corner of the dialog (
position: absolute). - The dialog must paint on top of the backdrop, the backdrop must paint on top of everything else.