<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/the-hidden-selectors-of-the-html-element-68aj7cuuh" -->

---
title: The Hidden Selectors of The HTML Element | daily.dev
description: Explores alternative CSS selectors for targeting the HTML root element beyond the standard `html{}` and `:root{}`. Demonstrates lesser-known approaches...
canonical: https://daily.dev/posts/the-hidden-selectors-of-the-html-element-68aj7cuuh
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: The Hidden Selectors of The HTML Element | daily.dev
og:description: Explores alternative CSS selectors for targeting the HTML root element beyond the standard `html{}` and `:root{}`. Demonstrates lesser-known approaches...
og:url: https://daily.dev/posts/the-hidden-selectors-of-the-html-element-68aj7cuuh
og:image: https://api.daily.dev/og/posts/68Aj7cUUh.png
og:image:alt: The Hidden Selectors of The HTML Element
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.

# The Hidden Selectors of The HTML Element

**[CSS Tip](https://daily.dev/sources/csstip)** · 2 min read · 34 upvotes · 2 comments

## Summary

Explores alternative CSS selectors for targeting the HTML root element beyond the standard `html{}` and `:root{}`. Demonstrates lesser-known approaches including the nesting selector `&`, `:scope`, `:has(head)`, `:not(* *)`, and `:not(* > *)`. Explains how these selectors work by leveraging fallback behaviors and unique characteristics of the HTML element, such as being the only element without a parent or having head and body as children.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://css-tip.com/root-selectors/>

## Community discussion

Top comments from developers on daily.dev.

**@gresakg** · 1 upvotes

> Curiosity? Yes. Usefull? No :)

**@elmarchavez** · 1 upvotes

> Thanks for new info!

## Similar posts on daily.dev

- [The Different Ways to Select <html> in CSS](https://daily.dev/posts/the-different-ways-to-select-html-in-css-iydpuo5lq) · CSS-Tricks · 16 upvotes · 1 comments
- [The CSS :has\(\) selector](https://daily.dev/posts/the-css-has-selector-csw5i3bag) · Flavio Copes · 20 upvotes · 1 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
- [Chris’ Corner: Lovingly Esoteric CSS](https://daily.dev/posts/chris-corner-lovingly-esoteric-css-znejy2bhb) · CodePen · 20 upvotes · 0 comments

---

Tags: [#webdev](https://daily.dev/tags/webdev), [#css](https://daily.dev/tags/css), [#frontend](https://daily.dev/tags/frontend), [#html](https://daily.dev/tags/html)

[View this post on daily.dev](https://daily.dev/posts/the-hidden-selectors-of-the-html-element-68aj7cuuh)

```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":"The Hidden Selectors of The HTML Element","url":"https://daily.dev/posts/the-hidden-selectors-of-the-html-element-68aj7cuuh","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/the-hidden-selectors-of-the-html-element-68aj7cuuh"},"datePublished":"2025-12-04T10:58:33.803Z","dateModified":"2025-12-04T10:58:49.342Z","description":"Explores alternative CSS selectors for targeting the HTML root element beyond the standard `html{}` and `:root{}`. Demonstrates lesser-known approaches...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/fe44d7a963d1a0b03d00c74761999c17?_a=AQAEulh","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/fe44d7a963d1a0b03d00c74761999c17?_a=AQAEulh","isAccessibleForFree":true,"articleSection":"CSS Tip","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":"CSS Tip","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/5d335233e7894c2ea997aa89e1724200","url":"https://daily.dev/sources/csstip"},"commentCount":2,"discussionUrl":"https://daily.dev/posts/the-hidden-selectors-of-the-html-element-68aj7cuuh","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":34},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":2}],"keywords":"webdev,css,frontend,html","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"CSS Tip","item":"https://daily.dev/sources/csstip"},{"@type":"ListItem","position":3,"name":"The Hidden Selectors of The HTML Element"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/the-hidden-selectors-of-the-html-element-68aj7cuuh","comment":[{"@type":"Comment","text":"Curiosity? Yes. Usefull? No :)","datePublished":"2026-01-19T09:12:19.923Z","url":"https://daily.dev/posts/68Aj7cUUh#c-JB1VNB4e4","author":{"@type":"Person","name":"Grergor","url":"https://daily.dev/gresakg","image":"https://media.daily.dev/image/upload/s--Mh3EhDVj--/f_auto/v1762860597/avatars/avatar_Z0Y5lKjimjGDZtplRmL1r?_a=BAMAK+ZW0"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}},{"@type":"Comment","text":"Thanks for new info!","datePublished":"2026-01-03T14:59:57.914Z","url":"https://daily.dev/posts/68Aj7cUUh#c-0MbFR433J","author":{"@type":"Person","name":"Elmar Chavez","url":"https://daily.dev/elmarchavez","image":"https://media.daily.dev/image/upload/s--7PjH979T--/f_auto/v1780994221/avatars/avatar_bK85rJb2OXXID2LX2wi5y?_a=BAMAMiWQ0"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}}]}
```

