Commit 1235b40
authored
Document new
Direct link:
https://tailwindcss-com-git-feat-document-compound-9d8eca-tailwindlabs.vercel.app/docs/adding-custom-styles#using-variants
This PR documents the new `@variant` behavior that was introduced in
tailwindlabs/tailwindcss#19996 where you can
stack variants (like you would in normal HTML):
```css
.my-element {
background: white;
@variant hover:focus {
background: black;
}
}
```
Which compiles to:
```css
.my-element {
background: white;
&:hover {
@media (hover: hover) {
&:focus {
background: black;
}
}
}
}
```
Similarly, this adds docs for compound variants, where you can define
the same CSS in different situations:
```css
.my-element {
background: white;
@variant hover, focus {
background: black;
}
}
```
Which compiles to:
```css
.my-element {
background: white;
&:hover {
@media (hover: hover) {
background: black;
}
}
&:focus {
background: black;
}
}
```
<img width="709" height="1251" alt="image"
src="https://github.com/user-attachments/assets/46089844-06c9-4640-ab3b-a05d69bea8f9"
/>@variant behavior where you can stack & compounds variants (#2481)1 parent 36c64db commit 1235b40
1 file changed
Lines changed: 45 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
331 | | - | |
| 331 | + | |
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
345 | 343 | | |
346 | 344 | | |
347 | 345 | | |
| |||
351 | 349 | | |
352 | 350 | | |
353 | 351 | | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
358 | 356 | | |
359 | 357 | | |
360 | 358 | | |
| |||
364 | 362 | | |
365 | 363 | | |
366 | 364 | | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
367 | 402 | | |
368 | 403 | | |
369 | 404 | | |
| |||
0 commit comments