Conditional CSS?

Is there any way to implement conditions on CSS? For example; use this CSS on weekdays but use another CSS on weekends.

I expect the answer to be “no” - but if you never ask, you never receive…

You can apply CSS conditionally based on the classes and attributes that are set on a tile.

Weekday vs Weekend isn’t one of those intrinsic classes though. It’s things like if the tile is active or not and what type of layout its using.

2 Likes

Thus could be possible if day-of-week text could be extracted from the date tile.

The day of week isn’t currently an attribute that’s accessible for CSS targeting. If it was, it would only be eligible for targeting in the Day of Week or Date tile themselves (eg. it wouldn’t be a top-level item that could be applied to the dashboard as a whole)

Can you share some more details about what you are trying to accomplish?

What I’m thinking is:

  • Add a virtual switch tile
  • Get day of week and put it in a text variable.
  • Turn virtual switch off
  • If text = “Saturday” (for example) turn virtual switch on.
  • If virtual switch active execute the CSS

Don’t know if this makes sense or not. Will bet on “not”.

The use cases are not at all critical - just “nice”. For example, the day-of-week on the date tile can be larger for all days except Wednesday, where 1em fills the field.

That kind of stuff.