Adding default styling to a component
Your change on the block doesn't work because you don't change the actual component (just the block's property) With cssComposer instead, by default, selectorManager accepts classes An easier way to add custom CSS might be this one But be careful, if store your templates and then run this command on any refresh this w...
Read full answer below ↓Question
I have been working on integrating grapesjs into a new development I'm working on. I have had much success with the documentation and wiki forum but am running into a few issues I'm hoping someone out there can help me with. I am working with a mobile view only, I have set the default device to mobile and hidden the option to change. When I insert an image, I would like the default css to include max-width: 100% as if I load a large image into the mobile view I will get an image much larger than the screen I'm looking at. I have tried: But I realize that might be an incorrect use and maybe on...
Answers (3)
Your change on the block doesn't work because you don't change the actual component (just the block's property) With cssComposer instead, by default, selectorManager accepts classes An easier way to add custom CSS might be this one But be careful, if store your templates and then run this command o...
Thank you! I was able to get that working with:
protectedCss: 'img {max-width:100%;}',
I have the same issue with videos and iframes (for youtube) being dropped onto the template larger than the screen size and the protectedCss solution did not work for those. Any suggestions?
protectedCss is loaded so the CSS is here, if it doesn't work probably your CSS technique is not correct
Related Questions and Answers
Continue research with similar issue discussions.
Issue #822
[QUESTION] How to get the html and css code in view code tool?
or how to get all the html code and css so that I could save it in my database. Or there is already a functionality in the documentation? y...
Issue #841
[QUESTION] Add default Trait (attribute) to model for all HTML Components (elements)
Hi, I've read the Traits, Components and API wikis, grepped all the open & closed issues. I've even found the code where you are creating t...
Issue #886
[HELP WANTED]: questions about some customization.
Hey Guys, first thank you very much for your work, this project seems really promising. I have a few question for a website i'm building. I...
Issue #1016
[Question] Button staying pressed after running command
Is there any way to keep a button from staying pressed after the command completes? Been looking through the documentation and didn't see a...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Related tutorials
In-depth guides on the same topic.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.