WordPress Developer Ukraine, Kyiv
CSS Custom Highlight API: Highlighting Text Ranges Without DOM Changes

CSS Custom Highlight API: Highlighting Text Ranges Without DOM Changes

The CSS Custom Highlight API: highlight search terms without changing the DOM Highlighting the search term in results used to mean wrapping every match in a <mark> element: a regular expression over HTML, broken markup when the term appears inside an attribute, and a re-render of the content. The Custom Highlight API highlights text ranges…
CSS @scope Rule: Scoped Styles Without Frameworks

CSS @scope Rule: Scoped Styles Without Frameworks

CSS @scope: styles that stay inside a component A rule like .card a { color: inherit; } also hits links in a newsletter form that someone places inside the card, and .prose p styles paragraphs in a nested block that should look different. BEM class names and growing specificity were the workarounds. @scope limits rules…
CSS Individual Transform Properties: translate, rotate, scale

CSS Individual Transform Properties: translate, rotate, scale

translate, rotate and scale as separate CSS properties transform is one property with a list of functions. A hover effect that only wants to scale a card has to repeat the card’s existing translate(), or it removes it; an animation of the rotation overwrites the position set elsewhere. The individual transform properties translate, rotate and…
CSS Relative Color Syntax: Auto-Generate Palettes from One Token

CSS Relative Color Syntax: Auto-Generate Palettes from One Token

CSS relative color syntax: a theme palette from one color token color-mix() blends two colors. Relative color syntax goes one step further: it takes a color apart into its channels and lets you change each of them with calc(). “The brand color, 15% lighter”, “the brand color with half the chroma”, “the complementary hue” become…
CSS Popover API: Native Tooltips and Dropdowns in WordPress Themes

CSS Popover API: Native Tooltips and Dropdowns in WordPress Themes

The Popover API: menus, tooltips and panels without JavaScript toggles Every theme has elements that open on click and close on Escape or a click outside: a user menu, a mini cart, a language switcher, a help tooltip. Each needs the same JavaScript: toggle a class, set aria-expanded, listen for Escape and outside clicks, manage…
CSS Anchor Positioning: Tooltips and Dropdowns Without JS

CSS Anchor Positioning: Tooltips and Dropdowns Without JS

CSS anchor positioning: tooltips and dropdowns without a positioning library A tooltip has to sit next to its button, stay inside the viewport and move to the other side when there is no room. JavaScript libraries like Popper and Floating UI exist only for this, and they recalculate positions on every scroll and resize. CSS…
CSS @starting-style: Animating Elements on First Render

CSS @starting-style: Animating Elements on First Render

CSS @starting-style: entry animations from display: none A dropdown that fades in when it opens sounds trivial, and in CSS it used to be impossible without JavaScript. The element goes from display: none to display: block, and a transition needs a “before” style to start from, but an element that was not rendered has none.…
CSS Container Style Queries: Data-Driven Component Variants

CSS Container Style Queries: Data-Driven Component Variants

Container style queries: component variants from a custom property Size container queries ask “how wide is my container?”. Style queries ask a different question: “what is the value of a custom property on my container?”. A card can then switch to its featured layout because a parent section sets --ha-variant: featured, without an extra class…