Skip to main

HTML & CSS Polyfills

Popover, CSS Anchor Positioning, Cascade Layers

Along with our work for the W3C developing specifications for the CSS language, OddBird has started and maintains a number of powerful polyfills for new web platform features including the Popover attribute, CSS Anchor Positioning, and Cascade Layers.

Explore Polyfills »

Demo | Source

Popovers take a state of “auto” or “manual”. If no state is provided, the
    popover takes on the behavior of its default state, which is “auto”. Auto
    popovers can be “light dismissed” by selecting anywhere on the page,
    clicking the popover control button, or opening another popover on the
    page.

OddBird’s Popover Attribute Polyfill – built in collaboration with Keith Cirkel and used in production by GitHub – lets developers preview the upcoming mechanism for displaying popover content on top of other page content, drawing the user’s attention to specific important information or actions that need to be taken.

This polyfills the HTML popover attribute and showPopover/hidePopover/togglePopover methods onto HTMLElement, as well as the popovertarget and popovertargetaction attributes on <button> elements.

Demo | Source

With polyfill applied Target and Anchors right edges line up

The CSS anchor positioning specification defines anchor positioning, “where a positioned element can size and position itself relative to one or more ‘anchor elements’ elsewhere on the page.” This CSS Anchor Positioning Polyfill supports and is based on this specification.

The proposed anchor() and anchor-size() functions add flexibility to how absolutely positioned elements can be placed within a layout. Instead of being sized and positioned based solely on the position of their containing block, the proposed new functions allow absolutely positioned elements to be placed relative to one or more author-defined anchor elements.

Demo | Source

Sample Content for Layers and the Polyfill - When layers are supported or
    if the polyfill is in use, you will see the default bootstrap button styles.
    In this demo, the Bootstrap CSS is imported into the lowest priority layer
    making any CSS written outside of the "framework" layer take priority. This
    means you can apply your own styles without having to worry about increased
    specificity.

PostCSS Cascade Layers lets you use @layer following the Cascade Layers Specification. For more information on layers, checkout A Complete Guide to CSS Cascade Layers by Miriam Suzanne.

Open Source Sponsors

Current Sponsors

A huge thank you to the individuals and organizations sponsoring OddBird’s open source work!

Open Collective Avatar for NorahOpen Collective Avatar for Outline GbROpen Collective Avatar for basherOpen Collective Avatar for Mat MarquisOpen Collective Avatar for HiddeOpen Collective Avatar for Paul van BuurenOpen Collective Avatar for JohannesOpen Collective Avatar for William KillerudOpen Collective Avatar for Nikita DubkoOpen Collective Avatar for Eric Portis

Sponsor OddBird’s OSS Work

We love contributing back to the languages & tools that developers rely on, from CSS & Sass to browser polyfills and Python. Help us keep that work sustainable and focused on developer needs!