Can I give default styling to an html tag like <p>?
Question
I want that p tag should always have 0 margin. How do I do that? The reason is that ckeditor is wrapping the text around a p tag and p tag has a margin that's making it all ugly.
Answers (2)
You can pass all the styles you want to your initial template
const editor = grapesjs.init({
container : '#gjs',
components: '<div class="txt-red">Hello world!</div><p>Text</p>',
style: '.txt-red{color: red} p {margin: 0}',
});
Exactly what I needed, Thanks!!
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2170
[QUESTION] Custom component - how to set editable to true
Hi, I've created a custom component type, but I am having some trouble making it editable. The component is a "span" with component type "t...
Issue #3422
How we can remove default text content from text component 'Insert your text here' ?
I want to remove default text from text component just like placeholder. every time when we drag text component we need to remove default t...
Issue #3328
How can I update the nodeValue (text value) of components by inputs forms
Hello. Grapesjs is a great tool. Thanks for it. I want to update the text value of a component by inputs, how can I do that?? if a user fil...
Issue #3231
how to change gjs-ckeditor-format component
hi guys, we all know that gjs-ckeditor-plugin working with [data-gjs-type]="text" components. I wanna know , could we change this option? I...
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 →Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.