CSS support integration for Godot JavaScript
Note: Will not work with classic Godot, you'll need Godot JavaScript version
In order to detach the project from Godot JavaScript, a GD4 translation is in progress.
Current JS features will be supported and new features like in-editor CSS editing will be added.
Make sur to watch this repo if you're interested, the project will probably be renamed/moved to a better suiting name.
- Godot JavaScript 3.x
Godot JS 4.x(too unstable for now)
- You can head to the
github-pageof this project to filter all supported properties: GodotJS CSS addon documentation
- git-clone this repo into your
res://addons/folder (should be namedgodotJS-CSS) - Enable the addon
- Create a
res://css/style.cssfile - Create a Div element and set its ID/class
- Write CSS in
res://css/style.css(you can use@importto split files) - The hot-reload feature will display changes (in-editor and in-game)
Note: If changes are not applied reload the project,missing css/style.css filebug will be fixed
- Custom
Divelement to set class/ID/inline-style - CSS file parsing - Only on
style.cssas entry point, use@importto split files - Inline CSS with Div property
- Hot reload on editor
and in-game- enabled only on editor, a toggle for in-game is planned -
:rootvariables - Direct inheritance: classes tree is applied only identifiers without pseudo-classes like
hoverorfocus- seeNext Features - Properties:
- Geometry: width, height, top, left, bottom, right
- Limits: max-width, max-height, min-width, min-height
- Transforms: scale, translate, origin
- Filters: backdrop-filter
- Border: width, color, radius
- Misc: background-color, opacity, cursor, box-shadow
- Animations: transition of all properties + font-size and color
- Values:
- Units:
px,%,em,rem,vw,vh,vmin,vmaxto match CSS Relative Lengths - (exandchignored) - Functions:
calc(%on width, left refers to parent width, height and top to parent height) - Mixins:
calccan be mixed withvar(),%or/andpx
- Units:
- Fonts:
- Import:
@font-face, requiresres://path forurlandfont-family - Properties:
color,font-sizeandfont-family
- Import:
- A custom
CSSelement to apply to root to be able to insert other files thanstyle.css - Code readability and performance optimizations
- Dropped:
- next pass issue won't allow thisblur, not only on background but on content as well - Dropped:
- DynamicFont properties won't allow thisexandchunits - Inheritance for pseudo classes:
.myClass:hover .myOtherClassdoesn't work for now but it's planned - Calculus Functions:
min,max(completingvarandcalc) to match CSS Functions
- No flow: All objects act as
absolute/fixedand expects top/left positionning,inlineandflexflow is ignored for now, will be planned if the feature becomes essential - For now, only
css/style.cssis acepted as entry point, will be fixed in future - Only one
backdrop-filterallowed as next-pass shaders are not integrated - backrgound-gradients, related to next-pass shaders problem, use gradient as child instead
