Hi @AzharBondi,
great progression so far.
While you can put css into templates by using
{% require_css %}
<style>
/* YOUR CSS */
</style>
{% end_require_css %}
(here’s the documentation for this since this is extremly useful for custom modules, sections and such)
I wouldn’t recommend this since it’s gonna add the CSS only to this template and this is definitely not a best-practise.
If you’re working with @Jnix284 approach of
:root{
--header_and_footer_bkgd_color: {{ theme.colors.header_and_footer_bkgd_color.color }};
}
you should put this into your theme-override.css and write it like this
:root{
--header_and_footer_bkgd_color: {{ theme.colors.header_and_footer_bkgd_color.color }};
}
/* more variables, CSS */
header,footer{
background-color: var(--header_and_footer_bkgd_color);
}
There are many ways how you can work with fields.json and the css files and as almost always: there is no right or wrong. It always depends on the client/project you’re working on
In most cases I write my CSS files like this:
{%- set header_footer_bg = theme.colors.header_and_footer_bkgd_color.color -%}
/* more variables, CSS */
header, footer{
background-color: {{ header_footer_bg }};
}
/* you can also do things like
header, footer{
background-color: rgba({{ header_footer_bg|convert_rgb }}, .3);
}
*/
By doing so you have all variables on top of the file and you don’t have to look for all interations of “theme.colors.header_and_footer_bkgd_color.css” in the file if you want to change something.
Again - there are countless ways to achieve your goal.
The most important thing is to get started and to understand if-statements, for-loops(repeater), filters and functions but once you’ve mastered them you can do quite a lot and modify the “CMS” part of HubSpot to your needs.
hope this helps
best,
Anton