RSS Amplifier

Trevor I. Lasn, Building 0xinsider · Nov 12, 2025

CSS :interest-source and :interest-target Pseudo-Classes

0
Sign in to vote or save

Trevor I. Lasn · Trevor I. Lasn

Style connected UI elements with CSS pseudo-classes that respond to user interest. Interactive examples showing tooltips, forms, and navigation without JavaScript.

Trevor I. Lasn Trevor I. Lasn ·

· Updated · 3 min read

Building 0xinsider.com, the intelligence layer for prediction markets. Discover what's moving, see who's behind it, and find the edge before the crowd.

CSS is getting new pseudo-classes that let you style elements based on user interest. The :interest-source and :interest-target pseudo-classes work with the interestfor HTML attribute to create relationships between elements, enabling interactive UIs without JavaScript.

These pseudo-classes are part of the Open UI Interest Invokers proposal, recently accepted by the CSS Working Group. They handle scenarios where hovering or focusing one element should affect the styling of another element elsewhere in the DOM.

The interest invoker system has two parts: an invoker element with the interestfor attribute, and a target element it references. When a user shows interest in the invoker (by hovering or focusing), both elements can be styled:

  • :interest-source matches the element with the interestfor attribute when it’s receiving interest
  • :interest-target matches the element being referenced when its invoker has interest

Both pseudo-classes support functional syntax with partial or total parameters. Partial interest means the user has focused the element but hasn’t activated it (like hovering), while total interest means full activation (like clicking).

Traditional CSS requires elements to be in specific DOM relationships (parent-child, siblings) to affect each other’s styles. Interest invokers break that limitation—any element can invoke interest in any other element via IDREF.

The HTML uses the interestfor attribute to establish the connection:

<button interestfor="tooltip-1">Hover me</button>

<div id="tooltip-1">Tooltip content</div>

Then CSS can style both the invoker and target:

/* Style the button when showing interest */

:interest-source {

background-color: lightblue;

}

/* Style the tooltip when its invoker has interest */

:interest-target {

opacity: 1;

visibility: visible;

}

One of the most common use cases is creating connected tooltips without JavaScript. When you hover over a button or link, you want to show additional information elsewhere on the page. The interest pseudo-classes make this trivial.

Navigation Highlighting

Another powerful use case is highlighting navigation items when their corresponding sections are in view or being interacted with. This creates a connected experience where different parts of your interface respond to user attention.

Form Field Relationships

Forms often have helper text, validation messages, or related inputs that should respond to focus on specific fields. Interest pseudo-classes make these relationships explicit and maintainable.

Browser Support and Fallbacks

These pseudo-classes were accepted by the CSS Working Group in July 2025. Chrome 139+ has experimental support behind a flag. The proposal is part of the Open UI initiative, not CSS Selectors Level 5. For production use, you’ll need JavaScript fallbacks or progressive enhancement until browser support matures.

You can detect support using CSS @supports:

@supports selector(:interest-source) {

/* Your interest pseudo-class styles */

}

The examples on this page use JavaScript to simulate the behavior until browsers ship support.

The CSS Working Group accepted the :interest-source and :interest-target proposal in July 2025, marking a significant step toward declarative interactive UI in CSS. Chrome 139+ already has experimental support, and the Open UI initiative is actively working to standardize these patterns across all browsers.

The proposal also includes plans for additional functionality, like the interest-delay-start and interest-delay-end CSS properties to control timing, and a potential possible parameter (currently deferred) for handling focusability edge cases.

This article was originally published on https://www.trevorlasn.com/blog/css-interest-pseudo-classes. It was written by a human and polished using grammar tools for clarity.

Read the original on trevorlasn.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.