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)
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
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.
Issue #1842
Showing two times some properties and not showing some options too.
Hello, @artf @NicoEngler, I have one strange issues. I am using grapes.js and grapes.min.css with version of 0.14.50. While i am selecting...
Issue #2184
[QUESTION] Losing predefined media queries
Hi. I have a predefined json of a template which contains a set of html elements and styles which are parsed into the set of components upo...
Issue #3389
MultiSelect some elements and change styles only work on the last selected element
Hi, when I MultiSelect some elements using shift, and change style in styleManager. Only the last clicked element will update the style. Ca...
Issue #3058
How to modify existing block properties in style manager
Version: 0.15.9 How to modify/remove few CSS properties for existing blocks like(text, image) in style manager I have checked the following...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.