Element selectors
HTML element selectors are automatically mapped to their Roblox GuiObject equivalents.HTML to Roblox class mapping
| CSS Selector | Roblox Selector | Notes |
|---|---|---|
div | Frame | Generic container |
span, p, h1-h6, label | TextLabel | Text display elements |
button, a | TextButton | Interactive buttons |
input, textarea | TextBox | Text input fields |
img | ImageLabel | Image display |
canvas | ViewportFrame | 3D viewport |
video | VideoFrame | Video playback |
scroll | ScrollingFrame | Scrollable container |
input.css
output.luau
Semantic elements
Semantic HTML elements all map toFrame:
| CSS Selector | Roblox Selector |
|---|---|
nav, header, footer, main, section, article, aside | Frame |
form, ul, ol, li | Frame |
table, thead, tbody, tfoot, tr, dialog | Frame |
Direct Roblox class selectors
You can use Roblox GuiObject class names directly. These pass through unchanged:input.css
output.luau
Class selectors
CSS class selectors map directly to Roblox CollectionService tags:input.css
output.luau
Special character escaping
rbx-css automatically escapes special characters in class names to work with Roblox’s selector parser. This makes Tailwind-style utility classes work seamlessly:input.css
output.luau
ID selectors
ID selectors map to Roblox instance name matching:input.css
output.luau
Pseudo-class selectors
CSS pseudo-classes map to Roblox GuiState selectors:| CSS Pseudo-class | Roblox GuiState | Use Case |
|---|---|---|
:hover | :Hover | Mouse over element |
:active | :Press | Element being pressed |
:focus | :NonDefault | Element has focus |
:disabled | :NonDefault | Element is disabled |
input.css
output.luau
Combinators
rbx-css supports the two combinators available in Roblox:Descendant combinator (space)
input.css
output.luau
Child combinator (>)
input.css
output.luau
Compound selectors
Combine multiple selector types:input.css
output.luau
Unsupported selectors
These selectors have no Roblox equivalent and are silently dropped:| CSS Selector | Reason |
|---|---|
* (universal) | No equivalent in Roblox |
:root | Handled specially for CSS variables |
::before, ::after | No pseudo-element support |
:first-child, :last-child, :nth-child() | No structural pseudo-classes |
:not(), :is(), :where(), :has() | No logical pseudo-classes |
[attribute] | Attribute selectors (except [data-theme] for theming) |
+, ~ | Sibling combinators |
Browser reset compatibility
rbx-css automatically ignores common browser reset selectors that have no Roblox equivalent (likehtml, body, head, meta, etc.), allowing you to use frameworks like Tailwind Preflight without warnings.