If you call this during window.load, then it's too late, addCss defines some css to load when creating the editor, but it does not change the executable instance.
So you can do it (using addCSS only):
CKEDITOR.on('instanceCreated', function(e) { e.editor.addCss( 'body { background-color: red; }' ); });
Or this (a more general way of working with an edited document)
CKEDITOR.on('instanceReady', function(e) { // First time e.editor.document.getBody().setStyle('background-color', 'blue'); // in case the user switches to source and back e.editor.on('contentDom', function() { e.editor.document.getBody().setStyle('background-color', 'blue'); }); });
source share