Menu

Spatial CSS preview puts 3D models on transform and anchor positioning
📰

Spatial CSS preview puts 3D models on transform and anchor positioning

DEV Community: css·Leo·about 3 hours ago
#D5tP7U0D
#devtocss#devto#dev#octagon#star
Long article (958 words) — no AI summary yet.
Reading 0:00
15s threshold

Put three 3D models on a page and you get three separate worlds. Each <model> has its own space and its own lighting. If you want one block to sit on a board, you work out the numbers yourself or you write JavaScript to do it.

In a post on the WebKit blog dated November 16, Brandel Zachernuk proposes giving that job to CSS. Safari on visionOS 27.3 includes a limited feature preview of the proposed spatial CSS API, starting with the <model> element. The post says spatial CSS "is made of a lot of small tweaks to existing syntax." That's what makes it interesting to me. The new parts look a lot like CSS you already write.

To try it on Vision Pro or in the visionOS Simulator, turn on Settings > Apps > Safari > Advanced > Feature flags > CSS Portals.

One container, one shared space

Everything starts with spatial: portal . Per WebKit, any element that can contain other elements, such as a <figure> or a <div> , can act as a portal, and all of its children share one space.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.