CSS - Glide Pages - color card container

In the community and as i recall earlier to color a card container you need the following css.

Edited: here is the post and solution by @ThinhDinh

div[class*=“StyledDiv6”] { background-color: #D8E3E9;

but after checking it seems that the above no longer colors the card, it colors the div holding the card
so i used the following and it worked
div[class*=“StyledDiv7”] { background-color: #C6B7A9;

how stable is css? does glide support it or confirm it will be consistent. We can avoid using it but its very nice on a UI UX level to use it. We are on a business plan, but don’t want to use it for a client & then find out it is breaking the UI UX in a couple months


I think it will be mostly consistent, as long as you use stable class names. I was surprised they changed StyledDiv6 to StyledDiv7 providing your post, but I haven’t noticed any problems in other CSS that I used.

is there any way to color the container with a color from that row’s data?

So that the container can have different colors depending on a certain status?

Has anyone made a suggestion to be able to provide class names to all components we add… even if it were just for the container component. Would make it very easy to target with CSS then - and it would not matter if behind the scenes Glide changed its naming.

No, you can’t have dynamic data. It’s static code inside the CSS box.

Since it’s static code, if Glide changes something, you would still have to check and rewrite as needed.

Personaly, I think it’s straightforward to look at the class names using inspect element. If you need help figuring out a class name, please let us know.

The problem is that there is no guarantee that the class names will not change with an update from Glide themselves… what I am suggesting is that you can add your own classname to a container as I have mocked up below:

So something like what we have now, but for the container level?

I haven’t dived in, but which level do they insert the class name in when we use this?

I had seen that option appear before… but not on all containers… which component is that option showing for?

That is on a container. Please show me an example where it doesn’t show up for you, assuming you have Business/Enterprise.

Ah. No I don’t have business/enterpise - but have definitely seen it appear on some components before. But yes, if it is available on a container then that would work fine… as you can then target easily with css selectors etc.

1 Like

I’m not sure which components would not have it show up for non Business/Enterprise, but ultimately the CSS part would only work on those plans anyway. Maybe Glide should not show that option when you’re not on the right plan to use it.

Agree it shouldn’t show if not of use. It would be nice to have CSS available at lower plans… I am not sure that anyone would pay to upgrade just for CSS.

i have dynamic data already to color the pins on the map depending on their title.

How “dynamic” is it though? Can you explain?

Yes not very dynamic…
it reads the title of a map collection and according to that it changes the color of the pin. Then in the css depending on that string there is different css…

Yeah then it’s not very dynamic because you would still have to know the titles in advance, as I understand.

1 Like

It seems the above css isn’t suitable if there is a collection in the card

So you only want to color the Child Assets part? Or the collection items?

i want to color the container card background… but as you see if you place a collection list or table, some parts of the list and table get colored as well. I changed it to a card and its fine.

However i just feel that its best to avoid custom css… doesn’t seem very stable

I doubt that it’s not stable, in this specific case, it’s because we’re targeting something that contains the same class names in different levels of the original DOM structure. When you change it to this it should work:

.form-card div[class*="section-container"] >div >div {
background-color: #C6B7A9;