There is a contentsCss option that allows you to load an external CSS stylesheet containing your custom style definitions. Using this, you can make your content what it will look like on your site. Therefore, to use it, you need to create a CKEditor instance as follows:
CKEDITOR.replace('mytextarea', { // Custom stylesheet for the contents contentsCss : 'assets/custom.css' });
And you would also define you custom.css , for example, as follows:
body { font-family: Arial, Verdana, sans-serif; font-size: 12px; color: #444; background-color: yellow; } h1, h2 { color: #555; background-color: #EFEFEF; }
EDIT. Using config.js
There are several ways to achieve what you need using the config.js file. Example:
CKEDITOR.editorConfig = function( config ) {
Create the contents.css file in the same folder as config.js . Inside, define your styles:
.body-yellow { background-color: yellow; }
What is it.
source share