N
N
NNn1312021-08-30 10:48:29
css
NNn131, 2021-08-30 10:48:29

How to make dynamic css style?

There is a site.
I want to give users the ability to customize the color of the elements however they wish. All this is done right in the settings on the site.

612c8b306ca0a382055486.png

Each element has its own class, which is responsible for the color. I need to change css style when changing settings from js.
How can I do that?

(As an option, store the style in the html style tag and completely recreate it when changing the settings. I wonder if there are less crutch solutions)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vadim, 2021-08-30
@NNn131

css custom properties
https://vanseodesign.com/css/custom-properties-and...
https://medium.com/@lucyhackwrench/%D1%87%D1%82%D0...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question