Changing background colour of Card Header. Bootstrap?

Please ref bloc attached

I’ve been trying to find out how to change the colour of the Card Header from a readymade bloc. I initially tried applying a bg colour using a custom class. That displayed ok in Blocs put in Preview and live site the bg looks to be light grey which I take to be the default. After looking in Inspector I believe the class I need to change is within Bootstrap:

.card-header {
padding: var(–bs-card-cap-padding-y) var(–bs-card-cap-padding-x);
margin-bottom: 0;
color: var(–bs-card-cap-color);
background-color: var(–bs-card-cap-bg);
border-bottom: 0;
}

Currently I only have very basic knowledge of BootStrap so have been trying to find the answer online, but keep falling down rabbit-holes.

Would be grateful if someone could confirm how I set the bg colour of the card-headers to that set by a freehand class in the first card.

Thanks in advance.
card-header-issue.bloc (2.6 MB)

Since no one has replied to help you master the card header…

If you want to change all the card headers to be one colour, just add the class .card-header to the class manager and change the background colour. No need to add the class to anything, it’s already being used in the HTML, you are just over-ridding the bootstrap default styling…

3 Likes

Thanks Pete, that makes things clear to me now. Oh, but update:
just tried this and still a problem… see Loom: Loom | Free Screen & Video Recording Software | Loom

I’m only on my phone and out of the office. So guessing here.

Did you happen to add some CSS manually to the CSS input zone in the code editor? The CSS we add there only applies in preview. In which case you are likely over-riding your over ride :grin:

1 Like

Thanks, knowing me that is likely :). I’ll need to look at later today…

background-color: var(–bs-card-cap-bg);

Yes, the value in the code editor matches that which I had copied and pasted from the Inspector in my original post. That’s why I got stuck as I can see it is controlled by bootstrap and overwriting what I was able change and view myself via Blocs. I’ve removed from the code editor now and sure enough the header colour is as I declared in .card-header.
I’ve just joined Blocs Master so sure understanding will deepen from now on.

Have fun. You can always ask in the forum here if you need some clarification to understanding how CSS works and specificity (the laws of CSS) and questions about the bootstrap framework. Understanding the basics can help a lot.

1 Like