CKEditor 4 combinate css

喜你入骨 提交于 2019-12-20 03:36:36

问题


I use CSS on my website to style the items.

In my (own developed) CMS I use CKEditor as WYSIWYG-editor.

I would like the editor to have the same style as the content on my webpage. The CSS of my page looks like this:

.content 
{
    ...
}
.content ul, .content ol 
{
    ...
}
.content p
{
    ...
}

But the stylesheet of CKEditor (contents.css) looks like this:

body
{
    ...
}
ol,ul,dl
{
    ...
}

h1,h2,h3,h4,h5,h6
{
    ...
}

Is there a way to make this in to one stylesheet, or to edit CKEditor, so a div.content is added?


I found the answer, change config.js to:

CKEDITOR.editorConfig = function( config ) {
    config.bodyClass = 'content'; //class that body needs to refer to
    config.contentsCss = '/css/beheer.css'; //your stylesheet

回答1:


In CKEDITOR, you write a <div> tag for any of your ol,ul,dl,h1,etc elements..

Just go to source code button in CKEDITOR and then you can edit the way you want.




回答2:


Like I edited on the startpost, I found the answer myself:

Change config.js to:

CKEDITOR.editorConfig = function( config ) {
    config.bodyClass = 'content'; //class that body needs to refer to
    config.contentsCss = '/css/beheer.css'; //your stylesheet


来源:https://stackoverflow.com/questions/14046408/ckeditor-4-combinate-css

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!