CKEditor 4 combinate css

2020-04-14 09:50发布

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

标签: css ckeditor
2条回答
在下西门庆
2楼-- · 2020-04-14 09:53

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.

查看更多
女痞
3楼-- · 2020-04-14 10:15

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
查看更多
登录 后发表回答