For thirty years, CSS has laid out flat pages. Even transform: translateZ() is a visual trick. The browser still flattens every 3D transform onto the plane of the page.
On November 16, 2026, WebKit released a developer preview of Spatial CSS, a proposal that gives CSS a real third dimension. Content can lift off the page toward you, and a box can turn into a window looking into a 3D world behind the page.
Chances are, the browser you’re using right now can’t render it. So I built every demo in this guide as a simulation using today’s CSS 3D transforms. You can drag, orbit and switch the camera to get a feel for what the spec describes.
The camera stands in for your head moving around a headset view: CSS can't set it. The box behind the window is a visual aid, since the real back context has no walls.
Skip to the first interactive demo
What Is Spatial CSS?
Spatial CSS is the working name for the CSS Spatial Layout Module Level 1, an early draft written by two Apple engineers. Its abstract is just one sentence:
“This module introduces three-dimensional layout to the CSS rendering model.” CSS Spatial Layout Module Level 1, Editor’s Draft, 27 November 2026
Layout is the key word here. You can already fake depth with perspective and 3D transforms, but the result is still painted onto a flat page. On displays that can show depth, Spatial CSS puts boxes at real distances in front of and behind the page.
WebKit announced the first implementation in Introducing spatial CSS: A developer preview, a post by Brandel Zachernuk. The preview covers six features:
spatial: portalturns an element into a window onto a shared 3D space.transformmoves objects inside a portal in real 3D.position-anchorwithposition-context: anchorsnaps one model to a point on another.@environment-mapdefines lighting that several models share.portal-action: orbitlets you rotate the scene.requestVolumetricScene()moves the scene out of the browser window and into the room.
The spec draft goes much further. It covers how to lift any element off the page, set depth limits, use a new media feature and take full control of the lighting. I’ll cover both the draft and the preview, and point out what you can try today.
Can You Use Spatial CSS Today?
Not in production, and not in a regular desktop or mobile browser. Here’s where each piece stands, based on the WebKit announcement:
| Feature | Where it works |
|---|---|
Spatial CSS (spatial, portal-action, @environment-map...) |
Safari on visionOS 27.3, behind the CSS Portals feature flag |
| visionOS Simulator in Xcode | Same preview, same flag |
The <model> element |
Safari 27, which WebKit says ships it on all platforms |
| Chrome, Edge, Firefox | No implementation. The announcement does not mention other engines. |
Spatial CSS is still a proposal, not a standard. Property names and syntax already differ between the WebKit preview and the latest spec draft, so read every snippet in this post as a sketch of where CSS is headed, not as code to ship.
The box below checks which Spatial CSS features the browser you’re using right now has.
Checking your browser...
The Mental Model: Two Spaces and a Sheet of Glass
Spatial CSS starts with a simple picture: imagine the page as a sheet of glass. The spec calls the space on each side a spatial context.
- The front spatial context is the space between the page and your eyes. When you lift content off the page, it moves into this space but still takes part in normal layout.
- The back spatial context is a separate 3D world behind the page. You can only see it through a portal, like looking into a room through a window.
The new spatial property has two values that create these spaces. spatial: page gives you a front context. spatial: portal gives you both, and the element’s own box becomes the window.
In the demo above, the gold card sits in the front context, and the blue box shows where the back context is.
spatial: page – Lifting Content Off the Page
Inside a spatial: page container, you can move a relatively positioned box along the Z axis using two new inset properties. inset-back pushes the box from the back, off the page toward you. inset-front is the mirror: it pushes from the front, into the page. A spatial: page box can’t sink below the page, and if you set both, inset-back wins.
.article {
spatial: page;
}
.card {
position: relative;
inset-back: 2cm;
}
Turn the camera to the side, then drag the slider. Head-on, a single flat picture can’t show depth, so the card only grows a little. From the side, you can see how far it floats.
Notice the units. The spec uses physical units like cm and mm in its examples because on a headset, a distance is a real distance.
spatial: portal – A Window Into a 3D World
Think of a portal as a window. Its 3D content goes into the world behind the glass, where every object shares one space. Regular content, like text, stays on the glass and lays out as usual.
In the WebKit preview, those children are <model> elements that load 3D files. According to the announcement, the spec is written so the same approach should work for all content.
<div class="world">
<model id="board" src="board.usdz"></model>
<model id="gem" src="gem.usdz"></model>
</div>
Two properties control what you see through the window:
portal-transformmaps the back world into the window. By default,autofits the content into the glass. Withnone, the scale stays at 1:1, so 1cm in the world is 1cm on the page.portal-actioncontrols what you can do in the window. You can tryorbitin the preview. The draft also listsresizeand severalpanvalues.
Try switching between the values below and drag inside the window (or focus it and use the arrow keys). Then switch to the flat browser to see what visitors get when their browser doesn’t support it.
For most of your visitors today, the flat view is what they’ll see by default: the portal is just a box with its background color. The 3D models need a fallback of their own, which the section on flat browsers below covers.
transform vs portal-transform
Most of the early coverage I read glosses over the distinction. There are two transforms, and they work at different levels.
In the WebKit post, the plain transform property moves individual models using the same DOMMatrix class as 2D transforms. Inside a portal, it works as a true 3D transform, so each object can move, rotate and scale on its own.
#octagon { transform: translateX(-50cm); }
#star { transform: translateX(50cm); }
portal-transform works one level up. It transforms the whole back context, as if you were moving a camera. The spec also notes that spatial containers ignore perspective and perspective-origin because depth is real now.
Anchor Positioning in Three Dimensions
A <model> is a void element, so you can’t put one model inside another. The preview reuses CSS anchor positioning to snap objects together instead.
In the WebKit demo, the board is a single 3D file with invisible marker points set up in Blender. CSS can pick out one of those points by name:
#board {
anchor-name: --board;
}
#gem {
position-anchor: --board#slot-2;
position-context: anchor;
}
position-context is the switch to watch. With container (the default), the gem follows the slot’s position but stays square to the page. With anchor, it also turns and scales with the slot, as if it were glued on. Pick a slot, then turn the board under each value:
Lighting With @environment-map
An environment map provides the surrounding light that reflects off a 3D object. It used to be an attribute on each <model>. In the preview, it’s a CSS at-rule inspired by @keyframes, so many models can share the same map.
The preview accepts 360-degree HDR images. The spec draft adds two longhands, environment-intensity and environment-rotate, plus an environment shorthand. Flip the syntax toggle in this demo to see how the two versions differ:
Real environment maps reflect HDR photos using physically based shading. CSS 3D has no lighting model at all, so I used gradients to fake the effect in this demo. Use it to get a feel for the syntax, not to judge what real reflections look like.
Comfort Limits: front-limit and Its Media Query
When content floats too close to your face, it’s uncomfortable. The spec treats that as an accessibility issue. The front-limit property caps how far content can move toward the viewer, and the browser may set the limit even lower.
If a box asks for more depth, the limit clamps it, and content transformed too far forward gets clipped. The new front-limit media feature lets you check how much depth you have to work with and design for both cases. It uses the same range syntax you might recognize from modern media queries.
Drop the limit below 1cm and the fallback branch kicks in. The toolbar stays on the page and gets a regular shadow instead.
Leaving the Window: requestVolumetricScene()
The last preview feature is a JavaScript method on the portal element. Call it in response to a user action like a click, and it moves the scene out of the browser window and into your room.
WebKit calls this a Connected Volumetric Scene. The page keeps a live link to the scene, so it can still add, remove or move objects.
const world = document.querySelector(".world");
launchButton.addEventListener("click", () => {
world.requestVolumetricScene();
});
WebKit’s post doesn’t say how a scene comes back to the page, so the reset button above only resets the simulation. The spec draft doesn’t define a JavaScript API at all: for now, requestVolumetricScene() exists only in the WebKit preview.
What Flat Browsers Do With Spatial CSS
This is my favorite part of the design, and WebKit puts the goal plainly:
“Spatial web standards should support designing for browsers wherever they run.” WebKit, Introducing spatial CSS: A developer preview
The WebKit explainer calls spatial layout a progressive enhancement. If a browser doesn’t support it, it ignores spatial, inset-back and the other new properties, just as it would any unknown CSS. Your page still renders as a normal flat page. If you want to style the flat version differently, wrap the spatial parts in a @supports feature query:
.card {
box-shadow: 0 8px 24px rgb(0 0 0 / 0.4);
}
@supports (spatial: page) {
.article {
spatial: page;
}
.card {
position: relative;
inset-back: 2cm;
box-shadow: none;
}
}
3D content needs its own plan. WebKit describes <model> as a void element, so don’t count on content nested inside it as a fallback. A safer pattern is a regular image that you swap for the model only when the browser supports the element:
const slot = document.querySelector(".world");
if ("HTMLModelElement" in window) {
const model = document.createElement("model");
model.src = "board.usdz";
slot.replaceChildren(model); // replaces the preview <img>
}
Where the WebKit Preview and the Spec Differ
The current draft is dated eleven days after the announcement, and they already disagree in a few places. If you’re testing on visionOS, use the preview syntax. If you want to follow the standard, keep an eye on the draft.
| Topic | visionOS 27.3 preview | Spec draft (27 Nov 2026) |
|---|---|---|
| Naming a lighting map | @environment-map { name: "x"; } |
@environment-map --x { } |
| Using it | environment-map: "x" |
environment-map: --x |
| Light strength and angle | Not covered | environment-intensity, environment-rotate |
| User interaction | portal-action: orbit |
orbit, resize, pan, pan-x, pan-y, pan-z and more |
| Scene outside the window | requestVolumetricScene() |
No JavaScript API |
| What can go 3D | Mainly <model> |
Any box, with spatial: page, inset-back and spatial-absolute |
Every Spatial CSS Property at a Glance
I’ve listed the properties from the current draft in the cheat sheet below and marked the ones the visionOS preview covers.
How to Try Spatial CSS on visionOS
You’ll need either an Apple Vision Pro or a Mac with Xcode to run the simulator. If you’re using the headset, here’s what to do:
- Update to visionOS 27.3.
- Open Settings > Apps > Safari > Advanced > Feature flags.
- Turn on CSS Portals.
- Open your test page or follow the link in the announcement to the WebKit puzzle demo.
If you don’t have a headset, install Xcode, add the visionOS Simulator, and turn on the same flag in the simulator’s Safari settings.
If you’re using any other browser, the demos in this post are as close as you can get for now. Each one has an Edit on CodePen button if you’d like to take the simulation apart.
FAQs
A few common questions about Spatial CSS:
spatial: page content can rise off the page toward the viewer, and with spatial: portal an element becomes a window into a 3D world behind the page.
@supports (spatial: page), and show a regular <img> until you know the browser supports <model>.
transform moves, rotates or scales one object inside a portal. portal-transform transforms the whole back world as it appears in the window. Its auto value fits the world to the glass, and none keeps a 1:1 scale.
requestVolumetricScene(), which moves a scene out of the browser window.
<model> is available in Safari 27 on all platforms, as a 3D object inside its own portal on the page. Spatial CSS adds the ability to put several models in one shared space, position them with CSS and light them together.
cm, mm and in. With portal-transform: none, 1cm in the back world equals 1cm on the page. How px should map into 3D is still an open issue.
Summary
Spatial CSS gives CSS a real third dimension. With spatial: page, content can rise toward you. Use spatial: portal and you get a window into a 3D world. Familiar tools like transforms, anchor positioning and media queries get a depth axis, too.
For now, it only runs on visionOS behind a flag, and the syntax is still changing. My favorite part is what happens when a browser ignores it: you still get a normal page. So when it ships, you can add depth to the pages you already have.
