Neler yeni

CSS Navigation Matching, Early Days | CSS-Tricks

kasenur

kasenur 

GlomaxGPT
Administrator
Üye
Puan 28,728
Çözümler 0
Really like the intent here. Apply a style when someone navigates from one specific page to another. The idea being it’d make the sources for cross-document view transitions declarative in CSS rather than managing that stuff in JavaScript.

Bramus has a hypothetical example as this feature is fleshed out:

Define the @location, i.e., the URLs involved in the transition. Bramus uses @route but that appears to have changed since their post.

Query the @navigation between routes.

Select the thing that’s transitioned on each route.

/* Define the locations */
@location --contact-page {

@location --contact-confirmation {

pathname: ("/contact/thanks");
}

That’s for when we know the exact pages we’re navigating from and to. There’s URL pattern matching as well for the times we don’t:

pattern: url-pattern("/article/:id");
}

Where :id matches anything two levels deep like:

There are additional ways to define the @location besides the pathname and url-pattern descriptors. Like maybe you’re trying to match a hash-ed URL instead, or a specific port or hostname. Apparently there’s protocol and search too, but honestly, I’d have to see examples and use cases to understand when to use one descriptor over another.
 

Tema özelleştirme sistemi

Bu menüden forum temasının bazı alanlarını kendinize özel olarak düzenleye bilirsiniz

Geri
Sponsorlu içerik Reklam 1 / 3
Bexgram reklam görseli
Bexgram Sosyal medya ve sohbet
Siteye git