如何在CKeditor中支持页边距顶部和页边距底部
我正在使用CKeditor,我想为我的文本中的许多段落设置页边距顶部和页边距底部,但它不起作用。这些是我迄今为止所尝试的: 1-直接在编辑器内使用边距顶部如何在CKeditor中支持页边距顶部和页边距底部,ckeditor,Ckeditor,我正在使用CKeditor,我想为我的文本中的许多段落设置页边距顶部和页边距底部,但它不起作用。这些是我迄今为止所尝试的: 1-直接在编辑器内使用边距顶部 <h2 style="margin-top:40px">What are tokens?</h2> 然后我在编辑中写道: <p class="ex1">What are tokens?</p> 什么是代币 这两种方法都不适用于,我使用的是CKeditor v4.6.2的完整工具栏 还有其他
<h2 style="margin-top:40px">What are tokens?</h2>
然后我在编辑中写道:
<p class="ex1">What are tokens?</p>
什么是代币
这两种方法都不适用于,我使用的是CKeditor v4.6.2的完整工具栏
还有其他方法吗?您需要告诉CKEditor加载您的CSS规则,并在
标记中允许您的类
属性:
创建一个新文件,比如说,my.css
,并将其放在CKEditor根文件夹中。
在my.css
中键入您的属性,例如:
p.ex1
{
margin-top: 100px;
}
p.ex2
{
margin-top: 50px;
}
现在,在config.js
中键入以下内容:
config.contentsCss = [CKEDITOR.getUrl('contents.css'), CKEDITOR.getUrl('my.css')];
config.extraAllowedContent = 'p(ex1,ex2)';
这将加载CKEditor自己的内容.css之外的my.css
,并指示CKEditor允许带有名为“ex1”和“ex2”的属性的标记,这样您就可以拥有什么是标记?
更多信息:
及
config.contentsCss = [CKEDITOR.getUrl('contents.css'), CKEDITOR.getUrl('my.css')];
config.extraAllowedContent = 'p(ex1,ex2)';