You’re referencing a CSS selector/utility pattern. Here’s a concise explanation and examples.
Meaning
- py-1 — a utility shorthand (common in frameworks like Tailwind CSS) that sets vertical padding (padding-top and padding-bottom) to a small size (1 unit). The exact value depends on the framework’s scale (e.g., Tailwind’s
py-1= 0.25rem / 4px by default). - [&>p]:inline — a Tailwind-style arbitrary selector that applies the utility
inlineto every direct childelement of the selected element. It uses the JIT arbitrary selector syntax: [&>p]:.
Combined usage examples (Tailwind-like)
- Apply small vertical padding to a container and make direct paragraph children inline:
…
- With HTML:
First
Second
Result: container has small vertical padding; both
are rendered inline.
Notes
- Requires a CSS utility framework that supports arbitrary selectors (e.g., Tailwind JIT). Plain CSS won’t recognize the [&>p]:inline class.
- Equivalent plain CSS:
.container { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.container > p { display: inline; }
Adjust the padding value to your framework’s scale if not using Tailwind.
Leave a Reply