<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/we-ve-only-scratched-the-surface-with-has--hesbz5225" -->

---
title: We've only scratched the surface with :has() | daily.dev
description: Exploring creative uses of the CSS :has() relational pseudo-class beyond basic examples, including structuring CMS content with conditional styling based on...
canonical: https://daily.dev/posts/we-ve-only-scratched-the-surface-with-has--hesbz5225
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: We've only scratched the surface with :has() | daily.dev
og:description: Exploring creative uses of the CSS :has() relational pseudo-class beyond basic examples, including structuring CMS content with conditional styling based on...
og:url: https://daily.dev/posts/we-ve-only-scratched-the-surface-with-has--hesbz5225
og:image: https://api.daily.dev/og/posts/HESbz5225.png
og:image:alt: We've only scratched the surface with :has()
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# We've only scratched the surface with :has()

**[utilitybend](https://daily.dev/sources/utilitybend)** · 6 min read · 0 upvotes · 0 comments

## Summary

Exploring creative uses of the CSS :has() relational pseudo-class beyond basic examples, including structuring CMS content with conditional styling based on sibling elements, handling complex table heading layouts, and building an interactive pagination component with hover-based animations using CSS custom properties. Firefox support was still pending at time of writing, and a feature-detection technique using @supports selector(:has(+*)) is recommended for progressive enhancement.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://utilitybend.com/blog/weve-only-scratched-the-surface-with-has>

## Questions this post answers

### How do I detect browser support for the CSS :has() selector with sibling combinators?

Use a feature query with @supports selector(:has(+*)) rather than just @supports selector(:has()), because this checks for a full feature report including relational combinator support. Testing only selector(:has()) can pass in browsers with incomplete or buggy implementations, so the more specific query with a combinator gives a more reliable support check for progressive enhancement.

_daily.dev surfaces practical CSS feature-detection patterns for developers rolling out :has() safely._

### How can I use CSS :has() to style a table heading based on table structure without changing the markup?

Combine :has() with nth-child selectors on the thead element to detect structural conditions, such as thead:has(+tbody th:nth-child(2)) th:nth-child(2) to draw a border only when a table body row unexpectedly contains a second heading cell. This lets developers apply conditional styling to tables even when they have no control over the underlying markup generated by a CMS.

_developers wrangling CMS-generated table markup can find similar CSS relational tricks on daily.dev._

## Similar posts on daily.dev

- [The CSS :has\(\) selector](https://daily.dev/posts/the-css-has-selector-csw5i3bag) · Flavio Copes · 20 upvotes · 1 comments
- [Can’t touch the DOM? Reach for :has\(\) to style any element](https://daily.dev/posts/can-t-touch-the-dom-reach-for-has-to-style-any-element-7yalpjtnd) · thoughbot · 9 upvotes · 0 comments
- [Practical CSS: Combining :has, :not, :only-child and :placeholder-shown pseudo-classes](https://daily.dev/posts/practical-css-combining-has-not-only-child-and-placeholder-shown-pseudo-classes-5gvvbff0w) · RUBYLAND · 7 upvotes · 0 comments
- [An Over-The-Top Spoiler Design with the Details Element – Frontend Masters Blog](https://daily.dev/posts/an-over-the-top-spoiler-design-with-the-details-element-frontend-masters-blog-0uqzmubnn) · Frontend Masters · 1 upvotes · 0 comments

---

Tags: [#css](https://daily.dev/tags/css)

[View this post on daily.dev](https://daily.dev/posts/we-ve-only-scratched-the-surface-with-has--hesbz5225)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"We've only scratched the surface with :has()","url":"https://daily.dev/posts/we-ve-only-scratched-the-surface-with-has--hesbz5225","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/we-ve-only-scratched-the-surface-with-has--hesbz5225"},"datePublished":"2026-09-20T07:43:20.760Z","dateModified":"2026-09-20T07:44:54.772Z","description":"Exploring creative uses of the CSS :has() relational pseudo-class beyond basic examples, including structuring CMS content with conditional styling based on...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/48a75fec35588a436e1967888e7ad5a2?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/48a75fec35588a436e1967888e7ad5a2?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"utilitybend","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"utilitybend","logo":"https://media.daily.dev/image/upload/s--hONVFSz4--/f_auto,q_auto/v1789890196/logos/utilitybend?_a=BAMAMicg0","url":"https://daily.dev/sources/utilitybend"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/we-ve-only-scratched-the-surface-with-has--hesbz5225","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"css","timeRequired":"PT6M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"utilitybend","item":"https://daily.dev/sources/utilitybend"},{"@type":"ListItem","position":3,"name":"We've only scratched the surface with :has()"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/we-ve-only-scratched-the-surface-with-has--hesbz5225#faq","mainEntity":[{"@type":"Question","name":"How do I detect browser support for the CSS :has() selector with sibling combinators?","acceptedAnswer":{"@type":"Answer","text":"Use a feature query with @supports selector(:has(+*)) rather than just @supports selector(:has()), because this checks for a full feature report including relational combinator support. Testing only selector(:has()) can pass in browsers with incomplete or buggy implementations, so the more specific query with a combinator gives a more reliable support check for progressive enhancement. daily.dev surfaces practical CSS feature-detection patterns for developers rolling out :has() safely."}},{"@type":"Question","name":"How can I use CSS :has() to style a table heading based on table structure without changing the markup?","acceptedAnswer":{"@type":"Answer","text":"Combine :has() with nth-child selectors on the thead element to detect structural conditions, such as thead:has(+tbody th:nth-child(2)) th:nth-child(2) to draw a border only when a table body row unexpectedly contains a second heading cell. This lets developers apply conditional styling to tables even when they have no control over the underlying markup generated by a CMS. developers wrangling CMS-generated table markup can find similar CSS relational tricks on daily.dev."}}]}
```

