Pseudo-classes
Learn how to use pseudo-classes in Yumma CSS.
Active
It represents an element that is activated by the user, typically by pressing the primary mouse button.
Try clicking and holding the button to see the active state.
<button class="bg-indigo a:bg-indigo-7 px-3 py-2 br-0 c-white">Press me</button>Focus
It represents an element that has received focus and is triggered when the user clicks or taps on it or uses the Tab key.
Try clicking on the input field to see how the border color and outline change.
<button class="bg-indigo f:oc-indigo-4 f:oo-2 f:os-s f:ow-2 px-3 py-2 br-0 c-white">Click me</button>Hover
It'll match an element when the user interacts with it using a pointing device. You don't need to press the mouse button to trigger it.
Try hovering over the button to see how the background color changes.
<button class="bg-indigo h:bg-indigo-7 px-3 py-2 br-0 c-white c-p">Hover me</button>Focus Visible
When an element matches the :focus pseudo-class and the UA (user agent) figures out through heuristics that the focus should be made evident on the element.
Try using Tab to focus the button with your keyboard.
<button className="bg-indigo fv:ow-2 fv:oc-indigo-2 px-3 py-2 br-0 c-white c-p">Focus me</button>Focus Within
It matches an element if the element or any of its descendants are focused.
Try clicking on the input field to see the container's border change.
<div class="fw:bc-indigo bw-2 bc-silver p-px"> <input class="p-2 bw-1 bc-silver" placeholder="Focus me" /></div>Here's a reference for all the pseudo-variants available in Yumma CSS.
| Pseudo-class | Prefix | Description |
|---|---|---|
:active | a:* | Applied when the element is being pressed |
:focus | f:* | Applied when the element receives focus |
:focus-visible | fv:* | Applied when focused via keyboard |
:focus-within | fw:* | Applied when element or child has focus |
:hover | h:* | Applied when the element is hovered |