Issue #2331Opened October 16, 2019by hellocaio0 reactions

CSS rules overwritten by cssComposer.setRule(...)

Question

My site has a custom sidebar to set site-wide colors, font-families, font-sizes and so on. When I change one style (i.e. text color), I lose any other styles that were previously set by my custom sidebar (i.e, font-family, font-size).

To change these styles I am doing:

 cssComposer.setRule("p", { "font-family": value });
 cssComposer.setRule("h1", { "font-size": value });
 cssComposer.setRule("a", { "color": value });

Is this the correct way going about changing site-wide styles? Why is it getting overwritten?

Answers (2)

artfOctober 19, 20190 reactions

When I change one style (i.e. text color), I lose any other styles that were previously set by my custom sidebar (i.e, font-family, font-size).

It's not clear to me what do you change and where the style is overwritten... maybe you can provide a live demo of your case?!

Doing this cssComposer.setRule("p", { "font-family": value }) is correct but it doesn't change the way CSS work, if you have another rule with a strongest selector, that will gonna win

no-response[bot]October 29, 20190 reactions

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.