Skip to content

Commit 74a71c0

Browse files
committed
docs: clarify direct child selector behavior in nested selectors
1 parent 4002b56 commit 74a71c0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,17 @@ Let's assume you want to style links inside lists differently to a general link,
9999

100100
Classify will take care of the order, so you don't need to define the nested selector before the general selector.
101101

102+
### Important: Direct child relationships
103+
104+
**Note:** Nested selectors use CSS direct child selectors (`>`), which means each element must be a **direct child** of the previous element in the selector.
105+
106+
For example:
107+
- `'li p'` matches `<li><p>content</p></li>`
108+
- `'ul p'` does **not** match `<ul><li><p>content</p></li></ul>` ❌ (because `p` is not a direct child of `ul`)
109+
110+
If you need to target elements with intermediate elements, define the complete path:
111+
- Use `'ul li p'` to match `<ul><li><p>content</p></li></ul>`
112+
102113
## Working with CSS frameworks (like TailwindCSS)
103114

104115
Some CSS frameworks utilize JIT compiling, or have some other means of purging CSS classes from production builds to reduce file size. Your classify CSS classes may not appear anywhere else in your template files, as they will be added dynamically. To make sure that your classes will be considered for compiling, you have to include the classify config file as content:

0 commit comments

Comments
 (0)