S&Box CSS subset

If I understand everything correctly you are manually implementing support for various selected CSS properties (backgrounds, borders, fonts, whatever), but this doesn’t mean that the whole current CSS3 spec will be supported by the S&Box UI framework.

My question is the following: are you guys currently keeping track of what CSS features/properties are implemented?

It’s probably worth creating a wiki page with everything that can be used even at this point, listing implemented/partially implemented/planned CSS features both for you not to get lost and other developers to be a bit less speculative about what is achievable “just as we do in web” and what isn’t.

Also, what are the priorities on the countless CSS features, what are you willing to support first/second/third of all? What are you certainly not going to support at all?

UPD 4/20/2021: Supported Style Properties - S&box Wiki

4 Likes

Yeah of course we have a list of properties that are available. A wiki page explaining what is and isn’t available would be a good idea I think.

Priorities on other css features would obviously differ based on usefulness vs difficulty to implement.

4 Likes

Complex display types like flex and grid are difficult enough to implement (I implemented flex layout for gmod and it wasn’t trivial), so I guess those aren’t of high priority for that reason? :frowning:

We use yoga for layout so flex is fully supported.

Grid is pretty useless for us and you’ll never change my mind.

6 Likes

Well yeah having flex is good enough for 95% of panels so I’m happy with that. Sounds great, thanks!

1 Like

Good question! I really like the UI approach that you guys choose, knowing that you’ll be able to use CSS and things like flex will be a huge benefit for the devs and the UIs of sbox. I also favor a wiki page for available CSS properties as soon as more members of the modding community are getting access to the game, a couple of my questions wouldn’t land here on this forum with that page.

Another great thing for the wishlist would be the ability to use css variables globally for a gamemode. Also if you could change this variable for a client though C# could be neat.

So imagine you’re creating a gamemode where you can have n amount of teams, each team with its own color. In the UI of each player you want to change its colors based on its team color. You could simply overwrite the variable on the client and the UI uses the new color without any further code.

2 Likes

If you will end up creating a wiki page explaining how CSS in S&Box works, it’s probably worth not only listing supported properties but also other CSS features like selector types, selector operators, pseudo-selectors, pseudo-elements, variables, media queries, available units, user-agent styles (default fonts, colors, etc.), etc. etc. etc.

A lot of this probably won’t be supported, especially in beta, but it’s important to make it clear.

1 Like

Good contribution I totally agree on that!

1 Like