Skip to content
Innovation & Growth

WebKit tests 3D scenes that a web page controls through CSS

A limited preview in Safari on visionOS 27.3 treats 3D objects like any other page content that adapts to its setting.

W
WebPulse Newsroom
AI-assisted · 4 min read
Share on X LinkedIn
WebKit tests 3D scenes that a web page controls through CSS
In brief
  • WebKit released a limited preview of proposed spatial CSS in Safari on visionOS 27.3. It handles 3D objects through the model element.
  • WebKit wants 3D content to adapt to screen size, colour theme and reduced motion through CSS, not extra JavaScript.
  • The preview is behind a feature flag and limited to visionOS. Leaders can ask teams how they build 3D content today.

A 3D scene is another setting the page has to adapt to

Most web teams already accept that a page must adapt. It changes for a phone, a wide monitor, a dark theme or a user who dislikes motion. WebKit's new preview asks a simple question. Why should 3D content be treated differently?

This is the idea behind spatial CSS. In WebKit's account, the web is at its best when authors can shape content around "device display capabilities, window size, and color theme." The preview extends that habit to 3D objects. It does not set up a separate system for them.

The lesson here is that the standard is being designed to keep 3D content inside the page's normal rules. That is a design choice, and it is WebKit's stated aim. It is not yet a finished standard.

What WebKit actually released

WebKit says Safari on visionOS 27.3 includes a limited feature preview of a proposed spatial CSS API. It focuses on 3D objects shown with the model element. The company says that element is now available in Safari 27 on all platforms.

The preview is switched off by default. WebKit says users turn it on in Safari's advanced settings, under a feature flag called CSS Portals. It can be tried on a Vision Pro or in the visionOS Simulator.

WebKit says the preview is limited to visionOS. It published the full proposed specification alongside it. WebKit calls this "a long journey" and asks authors to try the preview and report back.

How it works, in plain terms

Spatial CSS is built from small additions to existing syntax. WebKit demonstrates them with a set of children's blocks.

First, an element such as a figure or a div can be declared a portal with the new spatial:portal syntax. Every item nested inside shares one space. WebKit says the preview focuses on models, but the specification is written to work for all content.

Second, models inside a portal can be moved, rotated and scaled with the standard transform attribute. WebKit says it uses the same DOMMatrix class as 2D transforms, but now acts as a true 3D transform. Each block can move on its own.

Third, objects need to fit together, like furniture parts. A model cannot contain other models. So WebKit borrows the CSS idea of position-anchor, with position-context: anchor. A 3D editor marks reference points, often called null objects or empties. The page then attaches blocks to those points. Authors do not have to copy numbers out of the editor or guess at placement.

Fourth, lighting. An environment map is the lighting reflected off an object, or the room it sits in. WebKit moved it from an HTML attribute into a CSS rule called @environment-map, so more kinds of elements can share it. The preview supports 360-degree HDR images.

Fifth, interaction. A new portal-action attribute enables orbit, which lets users rotate a scene in place. WebKit says other modes, such as pan-x or pan-y, may come later.

Finally, visionOS can lift a scene out of the browser window into the user's room. WebKit calls this a Connected Volumetric Scene. A page launches it from a user action with requestVolumetricScene(). WebKit says the page stays linked to the scene, so it can add, remove or move objects.

Why declarative design matters to a manager

WebKit says routing spatial features through CSS lets a page respond to media queries for aspect ratio, colour theme and reduced motion. It says this means less JavaScript and no need to track complicated state. It also says the numeric parameters can be animated like any other value.

These are WebKit's claims about its own design. The preview is too new to show whether teams save any effort. Still, the direction is worth knowing. If it holds, 3D content would be maintained with the same skills and review habits as the rest of the site.

WebKit also stresses that spatial content should not be designed only for headsets. It notes a rise in websites showing 3D content on phones, tablets and computers. It says spatial standards should support designing "for browsers wherever they run."

What to ask your team

Nothing here calls for a purchase or a project. A preview on one platform, behind a flag, is a signal to watch. These questions are still cheap to ask.

Do we show 3D objects on our site today, such as product viewers? If so, how are they built, and how much custom JavaScript keeps them running? Does that content respect reduced-motion and colour-theme settings? Who on the team will try the preview in the simulator and report what they find? WebKit has asked for exactly that feedback.

The takeaway: WebKit's proposal makes 3D another thing a page adapts, and your team can test it now at little cost.

Produced by the WebPulse Newsroom with AI assistance from the original reporting credited below, and checked against that source by our editorial review. How we use AI.
Original reporting: WebKit.