Use CSS :has() and :not(:has()) to adapt layout to child content without JavaScript, Angular bindings, or class toggles.
Scanned 10/2/2026
npx -y skills add janpereira-dev/ngAutoPilot --skill css--selectors--has-content-aware-layout --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Css Selectors Has Content Aware Layout?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/janpereira-dev-css-selectors-has-content-aware-layout)More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.
---
id: css.selectors.has-content-aware-layout
name: CSS Has Content Aware Layout
description: "Use CSS :has() and :not(:has()) to adapt layout to child content without JavaScript, Angular bindings, or class toggles."
stack:
- CSS
category: selectors
status: stable
version: 0.10.0
owner: NgAutoPilot
triggers:
- css has
- content aware layout
- quantity query
---
# CSS Has Content Aware Layout
Use this skill when CSS can react to the DOM structure on its own.
## Purpose
Create layout rules that respond to child presence or quantity without JavaScript.
## When to Use
Use this skill when layout depends on visible DOM content and the condition is purely visual.
## Do
- keep selectors structural and readable
- use `:has()` as an enhancement
- keep Angular out of purely visual decisions
## Do Not
- move business logic into CSS
- depend on fragile third-party DOM
- hide accessibility behavior inside selectors
## Review Checklist
- [ ] The default layout works without `:has()`.
- [ ] The condition is purely visual.
- [ ] The selector is scoped and readable.
- [ ] Browser support was checked.
## Expected Output
Return:
1. The layout condition being modeled.
2. The CSS selector strategy.
3. The fallback/default layout.
4. Browser support or testing risks.
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!