<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/day-91-a-previous-sibling-selector-with-has--dausjdgmc" -->

---
title: Day 91: a previous sibling selector with :has() | daily.dev
description: Demonstrates how to use CSS :has() as a previous sibling selector — a technique not officially part of the CSS spec but achievable as a workaround. Shows how...
canonical: https://daily.dev/posts/day-91-a-previous-sibling-selector-with-has--dausjdgmc
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Day 91: a previous sibling selector with :has() | daily.dev
og:description: Demonstrates how to use CSS :has() as a previous sibling selector — a technique not officially part of the CSS spec but achievable as a workaround. Shows how...
og:url: https://daily.dev/posts/day-91-a-previous-sibling-selector-with-has--dausjdgmc
og:image: https://api.daily.dev/og/posts/DAuSjdgmC.png
og:image:alt: Day 91: a previous sibling selector 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.

# Day 91: a previous sibling selector with :has()

**[Manuel Matuzović](https://daily.dev/sources/matuzo)** · 2 min read · 0 upvotes · 0 comments

## Summary

Demonstrates how to use CSS :has() as a previous sibling selector — a technique not officially part of the CSS spec but achievable as a workaround. Shows how to highlight a button that precedes a hovered/focused sibling by combining :has() with adjacent sibling combinators, and extends the pattern to select elements two positions before the active one.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.matuzo.at/blog/2023/100daysof-day91>

## Similar posts on daily.dev

- [The different ways to use CSS :has\(\), with examples](https://daily.dev/posts/the-different-ways-to-use-css-has-with-examples-olvwfjtu1) · LogRocket · 10 upvotes · 0 comments
- [The CSS :has\(\) selector](https://daily.dev/posts/the-css-has-selector-csw5i3bag) · Flavio Copes · 20 upvotes · 1 comments

---

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

[View this post on daily.dev](https://daily.dev/posts/day-91-a-previous-sibling-selector-with-has--dausjdgmc)

```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":"Day 91: a previous sibling selector with :has()","url":"https://daily.dev/posts/day-91-a-previous-sibling-selector-with-has--dausjdgmc","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/day-91-a-previous-sibling-selector-with-has--dausjdgmc"},"datePublished":"2026-06-22T14:42:03.391Z","dateModified":"2026-06-22T14:43:22.009Z","description":"Demonstrates how to use CSS :has() as a previous sibling selector — a technique not officially part of the CSS spec but achievable as a workaround. Shows how...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/8524543a281574edcbd25d6cd208e478?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/8524543a281574edcbd25d6cd208e478?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Manuel Matuzović","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":"Manuel Matuzović","logo":"https://media.daily.dev/image/upload/s--EstFG5yE--/f_auto,q_auto/v1782139307/logos/matuzo","url":"https://daily.dev/sources/matuzo"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/day-91-a-previous-sibling-selector-with-has--dausjdgmc","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"css","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Manuel Matuzović","item":"https://daily.dev/sources/matuzo"},{"@type":"ListItem","position":3,"name":"Day 91: a previous sibling selector with :has()"}]}
```

