<!doctype html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="/assets/reset.css" rel="stylesheet"> <link href="setup.css" rel="stylesheet"> <link href="style.css" rel="stylesheet"> </head> <body> <section> <h2>A heading</h2> <p>This is a paragraph, so we have some text to overflow our container. Another sentence, another line. It’s probably nearly long enough now, but I’m just getting in the groove of typing it out.</p> </section> <section> <h2>A heading</h2> <p>This is a paragraph, so we have some text to overflow our container. Another sentence, another line. It’s probably nearly long enough now, but I’m just getting in the groove of typing it out.</p> </section> <section> <h2>A heading</h2> <p>This is a paragraph, so we have some text to overflow our container. Another sentence, another line. It’s probably nearly long enough now, but I’m just getting in the groove of typing it out.</p> </section> </body> </html>
body { --base: 20px; display: grid; font-family: 'Helvetica', sans-serif; gap: var(--base); padding: var(--base); } section { background-color: gold; padding: calc(var(--base) / 2); } h2 { font-size: calc(var(--base) * 3); }
section { position: relative } /* For the `absolute`. */ section::after { color: white; content: 'Appears in front!'; /* Give us an element to work with. */ inset: 2em; position: absolute; padding: 1em; } section:first-child::after { backdrop-filter: blur(8px); /* `blur` is a common use. */ background-color: color-mix(in srgb, #333, transparent) /* Shade it. */ } section:nth-child(2)::after { background-color: tomato; mix-blend-mode: multiply; /* Just like Photoshop/Figma! */ } section:nth-child(3)::after { backdrop-filter: invert(1); background-color: deepskyblue; mix-blend-mode: multiply; /* You can do crazy combinations. */ }