Block CSS collide with CSS rules already defined in template
Question
For block specific styles I'd recommend just using
styletagcontent: ` <section class="big-hero">...</section> <style> .big-hero{...} .... </style> `,If you want to preload external stylesheet inside the canvas
var editor = grapesjs.init({ ... canvas: { styles: [ 'https://...', ... ] } });
Hi @artf
When using <style> tag to define styles inside the 'content', after the block is dropped on the canvas, the css rules of the block overrides those of the elements that already in the canvas with the same selector.
For example, if the block has the following rules
.class1{ color: #fff; }
After the block is added, the other elements not inside the block that also have the 'class1' will also have the color changed to white
Even after I removed the newly added block, the new styles still exists
Any quick way to limit the scope of the block CSS to that particular block only? Or I need to update every selectors to prevent this happening?
Originally posted by @charlieshum1 in https://github.com/artf/grapesjs/issues/195#issuecomment-490852070
Answers (0)
No answers yet.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1807
GrapeJs framework breaks on adding external stylesheet
When i add my external stylesheet using the grapesjs framework no more works. How can I have the style sheet as well as the grapesjs framew...
Issue #442
Is it possible to include an external stylesheet in the grapesjs canvas?
We want to create some custom components whose style changes according to an external theme css (there can be different themes), and we wan...
Issue #3401
Can style manager always generate IDs instead of using already defined element's class ?
When we style an element in the editor, if this element doesn't have neither a class or an id, the style manager generate a new id with the...
Issue #859
[QUESTIONS] Change canvas style
Hi there, I have some question about canvas style, in this case i have config like this. By default i use css with name builder-desktop.css...
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.