Add custom CSS rule
Question
Hi!
I would like to add a CSS rule that, for instance, changes appearance of a component based on some attribute. I.e.
[data-role=something] {
background-color: red;
}
Is there a way of doing that programmatically? Or any other way for that matter.
Thanks,
Misha
Answers (2)
try with this
editor.addComponents('<style>[attr=val]{ color:red }</style>')
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2097
New views question
Hello all, Is there is any simple way to add a new view right next to the style manager? I would like to create a new view that will show s...
Issue #574
Using Grapes with Zeronet.
Is there a way to use grapesjs with zeronet? https://zeronet.io/ You can create sites on zeronet but to add headers, banners and other thin...
Issue #1324
Remove attributes from a component
Hi @artf I don't know if it is possible to remove an attribute from a component. In our project I'm injecting a custom attribute from a cus...
Issue #1227
Re-render view in editor's canvas whenever Trait value changes
Is there any possible way in grapesjs that whenever a user changes the value of a Trait of a custom component the render function should li...
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.